I found an awesome script which works fine but I am having trouble keeping the leading zeros of cells once the conversion happens.
Using this script
if WScript.Arguments.Count < 2 Then
WScript.Echo "Error! Please specify the source path and the destination. Usage: XlsToCsv SourcePath.xls Destination.csv"
Wscript.Quit
End If
Dim oExcel
Set oExcel = CreateObject("Excel.Application")
Dim oBook
Set oBook = oExcel.Workbooks.Open(Wscript.Arguments.Item(0))
oBook.SaveAs WScript.Arguments.Item(1), 6
oBook.Close False
oExcel.Quit
WScript.Echo "Done"
Before Conversion (Xlsx file)
After Conversion (CSV File)
UPDATE
If I try adding this:
oBook.Application.Columns("A:ZZ").NumberFormat = "@"
to my script like below it has no affect for formatting number cells to text
if WScript.Arguments.Count < 2 Then
WScript.Echo "Error! Please specify the source path and the destination. Usage: XlsToCsv SourcePath.xls Destination.csv"
Wscript.Quit
End If
Dim oExcel
Set oExcel = CreateObject("Excel.Application")
Dim oBook
Set oBook = oExcel.Workbooks.Open(Wscript.Arguments.Item(0))
oBook.Application.Columns("A:ZZ").NumberFormat = "@"
oBook.SaveAs WScript.Arguments.Item(1), 6
oBook.Close False
oExcel.Quit
WScript.Echo "Done"
Source: https://msdn.microsoft.com/en-us/library/office/ff195212.aspx