I am trying to use PowerShell functions to save Excel xlsx files to csv files. So I am using the below command:
`PS> Import-Excel "jj.xlsx" | export-csv -Path "jj.csv" -NoTypeInformation`
In the Excel file I have a date and "time" field that I receive from my users.
The excel file shows:
Date Time
10/28/2020 3:45 PM
11/23/2020 PM
In Excel I save the file as a CSV file, the output shows:
Date, Time, ...
10/28/2020,3:45 PM, ...
11/23/2020,PM, ...
When I try to use the above PowerShell commands above, the csv file looks like:
"Date","Time", ...
"10/28/2020 12:00:00 AM", "0.65625", ...
"11/23/2020 12:00:00 AM", "PM", ...
(Converted the time entered in first record to a fractional number)
Should I be using parameters in the Export-csv command to make it look like what Excel provides when saving as a csv file?
I figure it must be something easy. I'm new to Powershell, so any help would be appreciated.
Thanks,
question from:
https://stackoverflow.com/questions/65924752/using-powershell-export-csv-to-save-like-excel-csv 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…