Corruption/Loss of Data with Excel Data Types (stock, currency, etc)
dbytes opened this issue · 5 comments
The following will cause corruption or loss of data to an existing sheet (sheet1) that contains Excel Data Types such as stocks.
$data = ConvertFrom-Csv @'
Ticker,Date,Units
VOO,11/22/2024,10
VTI,11/20/2024,50
'@
$data | Export-Excel -Path 'invest.xlsx' -WorksheetName 'import' #imports to a new sheet
Excel Workbook as example data:
invest.xlsx
Does -append do what you need?
No, that has the same issue.
if you have plain text in the col A. does it work? not sure of the image and/or the ; colon
If it was plain text it is fine, but this has been converted to an Excel Data Type.
Setting up the data type, you would enter a ticker such as VOO as plain text in A1 and then convert it. I've included a GIF to show how to set this up if you were not aware.
EDIT: I can update this Workbook without issue when working directly with the COM Object.
Yeah, the COM approach is completely different. I don't think the translation in the EPPlus layer is handling it and I don't have control over that.


