To convert Excel to CSV with PowerShell, open the workbook through Excel’s COM object and save it with file format 6 (xlCSV). On a machine without Excel, the ImportExcel module does the same job in one line:
$workbook.SaveAs('C:\Reports\sales.csv', 6)
Import-Excel -Path .\sales.xlsx | Export-Csv -Path .\sales.csv -NoTypeInformation
The two routes don’t produce the same file, though. Below I convert a real two-sheet workbook both ways in PowerShell 7 and Windows PowerShell 5.1, and show where dates, currency and accented names come out differently.
Convert an Excel file to CSV with the Excel COM object
My test workbook, sales-2026.xlsx, has a Sales sheet with store names, cities that contain commas, a currency column, a date column built with formulas, and a total row. It also has a second sheet called Returns.
This script starts a hidden copy of Excel, opens the workbook, saves it as CSV and closes everything in a finally block, so Excel quits even if a line fails:
$xlsx = 'C:\psfaqs\XlCsv\sales-2026.xlsx'
$csv = 'C:\psfaqs\XlCsv\sales-2026.csv'
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
try {
$workbook = $excel.Workbooks.Open($xlsx)
$workbook.SaveAs($csv, 6) # 6 = xlCSV
"Workbook is now: $($workbook.Name)"
$workbook.Close($false)
}
finally {
$excel.Quit()
[void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($excel)
[GC]::Collect()
}
Get-Content -Path $csv
Output:
Workbook is now: sales-2026.csv
Store,City,Rep,Sales,Updated
Downtown,"Austin, TX",Maria Lopez,"$1,250.50",2026-10-05
Riverside,"Denver, CO",Linh Nguy?n,$980.00,2026-10-06
Harbor,"Seattle, WA",Tom Baker,"$1,105.25",2026-10-07
,,Total,"$3,335.75",

A few things in that output are worth noticing. Excel writes what you see in the cell, so the sales figures keep their dollar signs and thousands separators, and cells with commas get quoted.
The open workbook was also renamed to sales-2026.csv after SaveAs. That’s why the script closes it with $false, which skips the save prompt. If you’d rather keep a tab on the file first, see checking that a path exists with Test-Path.
Always pass full paths to SaveAs and Open. Excel doesn’t know about your PowerShell location, so a bare file name ends up in Excel’s own current folder, which is usually Documents.
xlCSV (6) vs xlCSVUTF8 (62): which file format number to use
Look at the Riverside row above: the rep’s name came out as “Linh Nguy?n”. Format 6 saves in the code page of the Windows system locale, and a character that isn’t in that code page is replaced with a question mark.
Here are the CSV-related XlFileFormat values from the Excel reference:
| Name | Value | What you get |
|---|---|---|
| xlCSV | 6 | CSV in the system code page (ANSI) |
| xlCSVUTF8 | 62 | CSV in UTF-8 with a byte order mark |
| xlCSVWindows | 23 | Windows CSV |
| xlCSVMSDOS | 24 | MS-DOS CSV |
| xlUnicodeText | 42 | Tab-delimited Unicode text, not CSV |
| xlOpenXMLWorkbook | 51 | A normal .xlsx workbook |
To see the difference, I saved the same workbook with 6 and with 62, then checked the first three bytes of each file and whether the full name survived: