Make a copy of an Excel file as a CSV without having Excel "re-open" the file as a CSV
Solution 1:
There is no way to change the behavior of Excel without VBA or an add-in.
The following add-ins might be able to help:
- XLTools (commercial)
- excel-csv-import
- CSV Import+Export
But perhaps it's better to avoid doing the Save As in Excel and do it rather with a PowerShell script. This way you would also be able to save multiple Excel worksheets with one script.
Here is an example PowerShell function (totally untested) :
Function ExcelToCsv ($File) {
$myDir = "D:\Excel"
$excelFile = "$myDir\" + $File + ".xlsx"
$Excel = New-Object -ComObject Excel.Application
$wb = $Excel.Workbooks.Open($excelFile)
foreach ($ws in $wb.Worksheets) {
$ws.SaveAs("$myDir\" + $File + ".csv", 6)
}
$Excel.Quit()
}
An example usage (untested):
$FileName = "\path\to\workbook"
ExcelToCsv -File $FileName