Batch Process Excel Files to CSV
To efficiently convert multiple Excel files (.xlsx or .xls) to CSV without the need to open each file individually, a recommended method involves utilising PowerShell on Windows without requiring additional installations. Assuming you are using Windows with Excel installed, you can execute the following PowerShell script:
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
$folder = "C:\Path\To\Excels" # change to your folder path
$output = "C:\Path\To\CSVs" # change to output folder path
$xlCSVUTF8 = 62 # UTF-8 CSV format
Get-ChildItem -Path $folder -File | Where-Object { $_.Extension -match '\.xls[x]?$' } | ForEach-Object {
$workbook = $excel.Workbooks.Open($_.FullName)
$csvPath = Join-Path $output ($_.BaseName + ".csv")
$workbook.SaveAs($csvPath, $xlCSVUTF8) # use UTF-8 format
$workbook.Close($false)
}
$excel.Quit()
To convert the modern Excel file format (.xlsx) to CSV use the following (this has a modified Get-ChildItem line):
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
$folder = "C:\Path\To\Excels" # change to your folder path
$output = "C:\Path\To\CSVs" # change to output folder path
$xlCSVUTF8 = 62 # UTF-8 CSV format
Get-ChildItem -Path $folder -Filter *.xlsx | ForEach-Object {
$workbook = $excel.Workbooks.Open($_.FullName)
$csvPath = Join-Path $output ($_.BaseName + ".csv")
$workbook.SaveAs($csvPath, $xlCSVUTF8) # use UTF-8 format
$workbook.Close($false)
}
$excel.Quit()
Here is an example of a input path:
C:\Users\garyv\Documents\Downloads\2023group08
Here is an example of a output path:
C:\Users\garyv\Documents\Downloads\csv
Topic last reviewed: 19/08/25