Home » excel » excel – Delphi 7 convert XLS(X) to CSV

excel – Delphi 7 convert XLS(X) to CSV

Posted by: admin May 14, 2020 Leave a comment

Questions:

I need something to convert XLS or XLSX files to csv(semi-colon separated). It could be a component, a dll or a command line tool but it must be unattended, not visible to the user and preferably have native support so no need for Excel to be installed.

How to&Answers:

Lots of good suggestions here. It seems not many of these support XLSX though.

Answer:

I’m not sure what you mean by “unattended”, but I think I would try to access and read the Excel files using ADO (dbGo) in Delphi. A comprehensive how-to article is available at About.com Delphi. Once the Excel data is in a TADOTable, it should be fairly easy to rewrite the table data into the desired CSV format and save it to a file.

Answer:

It seems that the ADO method supports reading and writing to XLS, XLSX, and XLSB files.

However, the 2010 version of the Microsoft Access Database Engine must be installed. The redistributable is free, and it doesn’t require installation of Excel or Microsoft Office.

I verified last night that it works with all three Excel file formats and you can get my sample code that demonstrates converting a spreadsheet into a CSV file:

Converting Excel spreadsheets to CSV with ADO

Answer:

SMImport from Scalabium supports XLS and XLSX natively. It’s reasonably priced with good support. We have used it with great success.