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

Getting the value of a cell with number format? #71

Closed
ktiniatros opened this issue Jun 6, 2019 · 4 comments · Fixed by #102
Closed

Getting the value of a cell with number format? #71

ktiniatros opened this issue Jun 6, 2019 · 4 comments · Fixed by #102
Assignees
Labels
documentation Documentation improvements enhancement New feature or request

Comments

@ktiniatros
Copy link

Hello,

I cannot read values from cells which contain numbers, eg the value 1,19. The cell is formatted as Number.

Is this possible with this library?

Thanks!

@MaxDesiatov
Copy link
Collaborator

Hi @ktiniatros, thank you for reporting this issue. Would you be able to attach the spreadsheet file and specify cells that you're having the problem with? That would greatly help in fixing the issue.

If your spreadsheet file contains any sensitive information that can't be shared publicly, can you please send it to hello@corexlsx.org?

@MaxDesiatov MaxDesiatov added the more info needed Not enough details available to proceed label Jun 6, 2019
@ktiniatros
Copy link
Author

ktiniatros commented Jun 12, 2019

It turns out I was trying to access the cell number value in the wrong way. But I believe I was a bit mislead by the inconsistency of the api + the lack of documentation. I'll explain what I mean:
If cell 1 of a row contains a string then row.cells[1].value returns the index to file.parseSharedStrings()
But if cell 1 of a row contains a number then row.cells[1].value returns the value (i.e. the number itself).
I would expect either to get always indexes or always the values themselves.

Please don't take this comment personally, it's just feedback. You've done a great job with this library, which helped me a lot and I thank you for that!

@MaxDesiatov
Copy link
Collaborator

MaxDesiatov commented Jun 13, 2019

Thank you very much for the update @ktiniatros, I'll keep this issue open until the documentation and the API are updated if you don't mind.

@MaxDesiatov MaxDesiatov reopened this Jun 13, 2019
@MaxDesiatov MaxDesiatov added documentation Documentation improvements and removed more info needed Not enough details available to proceed labels Jun 13, 2019
@MaxDesiatov MaxDesiatov added the enhancement New feature or request label Jun 13, 2019
@MaxDesiatov
Copy link
Collaborator

There's a new API added with an extension on the Cell type: func stringValue(_: SharedStrings) -> String? in #102, it automatically checks if a cell references a shared string and fetches one if needed, otherwise it returns an inline value as a string. Hope that resolves the issue.

MaxDesiatov added a commit that referenced this issue Apr 6, 2020
New `stringValue` and `dateValue` helpers on the `Cell` type are added, which allow getting corresponding string (including shared strings) and date values easier.

Resolves #71
Resolves #89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation improvements enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants