Instructions
- Copy both files into the directory containing the files you want converted
- Run
excel-to-csv.bat
Note: This script requires Excel to be installed.
excel-to-csv.batNote: This script requires Excel to be installed.
| FOR /f “delims=“ %%i IN (‘DIR *.xls* /b’) DO to-csv.vbs “%%i“ “%%i.csv“ |
| if WScript.Arguments.Count < 2 Then | |
| WScript.Echo “Please specify the source and the destination files. Usage: ExcelToCsv <xls/xlsx source file> <csv destination file>” | |
| Wscript.Quit | |
| End If | |
| csv_format = 6 | |
| Set objFSO = CreateObject(“Scripting.FileSystemObject”) | |
| src_file = objFSO.GetAbsolutePathName(Wscript.Arguments.Item(0)) | |
| dest_file = objFSO.GetAbsolutePathName(WScript.Arguments.Item(1)) | |
| Dim oExcel | |
| Set oExcel = CreateObject(“Excel.Application”) | |
| Dim oBook | |
| Set oBook = oExcel.Workbooks.Open(src_file) | |
| oBook.SaveAs dest_file, csv_format | |
| oBook.Close False | |
| oExcel.Quit |
6,909 total views, 9 views today
Comments
So empty here ... leave a comment!