Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corruption/Loss of Data with Excel Data Types (stock, currency, etc) #1660

Open
dbytes opened this issue Nov 22, 2024 · 5 comments
Open

Corruption/Loss of Data with Excel Data Types (stock, currency, etc) #1660

dbytes opened this issue Nov 22, 2024 · 5 comments

Comments

@dbytes
Copy link

dbytes commented Nov 22, 2024

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

Before:
before

After:
after

Excel Workbook as example data:
invest.xlsx

@dfinke
Copy link
Owner

dfinke commented Nov 22, 2024

Does -append do what you need?

@dbytes
Copy link
Author

dbytes commented Nov 22, 2024

No, that has the same issue.

@dfinke
Copy link
Owner

dfinke commented Nov 22, 2024

if you have plain text in the col A. does it work? not sure of the image and/or the ; colon

@dbytes
Copy link
Author

dbytes commented Nov 22, 2024

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.

2024-11-22_08-38-11

@dfinke
Copy link
Owner

dfinke commented Nov 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants