Convert XLS to CSV on command line

后端 未结 15 2274
臣服心动
臣服心动 2020-11-22 12:11

How could I convert an XLS file to a CSV file on the windows command line.

The machine has Microsoft Office 2000 installed. I\'m open to installing OpenOffice if it\

15条回答
  •  庸人自扰
    2020-11-22 12:55

    Scott F's answer is the best I have found on the internet. I did add on to his code to meet my needs. I added:

    On Error Resume Next <- To account for a missing xls files in my batch processing at the top. oBook.Application.Columns("A:J").NumberFormat = "@" <- Before the SaveAs line to make sure my data is saved formatted as text to keep excel from deleting leading zero's and eliminating commas in number strings in my data i.e. (1,200 to 1200). The column range should be adjusted to meet your neeeds (A:J).

    I also removed the Echo "done" to make it non interactive.

    I then added the script into a cmd batch file for processing automated data on an hourly basis via a task.

提交回复
热议问题