Convert .CSV to .XLSX using command line

前端 未结 5 1001
-上瘾入骨i
-上瘾入骨i 2020-12-10 14:45

I\'m looking for a way to batch-convert a series of .csv files to .xlsx using the command line.

I have tried a bunch of different VBScripts

5条回答
  •  情歌与酒
    2020-12-10 15:27

    only pre-requisite is that the ".csv" must be lower case in the filename:

    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!"
    

提交回复
热议问题