Convert xlsx file to csv using batch

后端 未结 7 911
醉酒成梦
醉酒成梦 2020-12-01 03:10

How do you convert multiple xlsx files to csv files with a batch script?

相关标签:
7条回答
  • 2020-12-01 04:15

    Get all file item and filter them by suffix and then use PowerShell Excel VBA object to save the excel files to csv files.

    $excelApp = New-Object -ComObject Excel.Application 
    $excelApp.DisplayAlerts = $false 
    
    $ExcelFiles | ForEach-Object { 
        $workbook = $excelApp.Workbooks.Open($_.FullName) 
        $csvFilePath = $_.FullName -replace "\.xlsx$", ".csv" 
        $workbook.SaveAs($csvFilePath, [Microsoft.Office.Interop.Excel.XlFileFormat]::xlCSV) 
        $workbook.Close() 
    } 
    

    You can find the complete sample here How to convert Excel xlsx file to csv file in batch by PowerShell

    0 讨论(0)
提交回复
热议问题