Asp imports and exports excel documents
I tried many methods, but they were all a little troublesome. Either it cannot be exported, or the exported cannot be imported.
The final plan is:
Export: First build a blank excel document and place it somewhere on the server. When exporting, first COPY the document as the document to be exported. Then treat the document like a database, and each workbook is a table. Use the ADODB.Connection connection to write the data to be exported. After completion, response.redirect is sent to the client.
Import: First upload the excel document to the server, then use ADODB.Connection to connect to the document, read the data and write it to the website database.
What should be noted here is that ReadOnly=0 needs to be added to the connection string; otherwise, the excel table can only be read and not written. This problem has been bothering me for a long time. The reason according to MSDN is that the default method for EXCEL is read-only.
Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/life/Asp-imports-and-exports-excel-documents.htm