Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Created December 9, 2015 17:25
Show Gist options
  • Save JamoCA/62666b5ef89ec54ef3c2 to your computer and use it in GitHub Desktop.
Save JamoCA/62666b5ef89ec54ef3c2 to your computer and use it in GitHub Desktop.
Visual Basic Script to convert CSV file to XLSX. (Excel is required to be installed.)
'======================================
'Visual Basic Script to convert CSV file to XLSX. (Excel is required to be installed.)
'http://stackoverflow.com/a/31606893/693068
'Further customization ideas and information regarding permissions at:
'http://jeffkinzer.blogspot.com/2010/06/vbscript-to-convert-csv-to-xlsx.html
'
'FORMAT: CSCRIPT CSV_To_XLSX.vbs "c:\base\data.csv"
'(Note: CSCRIPT is required to run VBS file using the command line.)
'======================================
Dim file, WB
With CreateObject("Excel.Application")
On Error Resume Next
For Each file In WScript.Arguments
Set WB = .Workbooks.Open(file)
WB.SaveAs Replace(WB.FullName, ".csv", ".xlsx"), 51
WB.Close False
Next
.Quit
End With
WScript.Echo "Done!"
@awise777
Copy link

Thank you for sharing. In case you dont have Excel installed you can use an online converter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment