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

Reading data as a string #651

Closed
MrSent opened this issue Aug 29, 2023 · 3 comments
Closed

Reading data as a string #651

MrSent opened this issue Aug 29, 2023 · 3 comments

Comments

@MrSent
Copy link

MrSent commented Aug 29, 2023

I have some input data in a spreadsheet. The column data is 694142.01

I have no control over the formatting as the spreadsheet is created by an external system. When I do reader.GetString(0) on that file is throws an exception "Unable to cast object of type 'System.Double' to type 'System.String'."

I don't really care that the data can be treated as a double. I want it as a string. Why does reading the data as a string cause it to throw an error?

@MrSent
Copy link
Author

MrSent commented Aug 29, 2023

This solved it #452

@MrSent MrSent closed this as completed Aug 29, 2023
@kerams
Copy link

kerams commented Mar 3, 2024

It isn't solved, particularly for dates. For whatever reason the library decides (or perhaps it's encoded that way in xls, I don't know) to interpret strings as dates/numbers if possible. If I wanted to do that, I can trivially do so myself. What isn't trivial is getting the original raw representation - GetNumberFormatString is of no help.

@appel1
Copy link
Collaborator

appel1 commented Mar 3, 2024

The raw representation is a double.

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

3 participants