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

GetCellValue does not return raw value, even with the option RawCellValue: true #1161

Open
ffleader1 opened this issue Feb 28, 2022 · 6 comments

Comments

@ffleader1
Copy link

ffleader1 commented Feb 28, 2022

Unless I am reading the doc from, I suppose by passing the GetCellValue with the option RawCellValue set to True:

	cell, err := f.GetCellValue(sheet, cellLoc, excelize.Options{
		RawCellValue: true,
	})

I can get the raw text of what has been written in the cell.
Does not seem to be the case though.
The above line would gimme me the result of the formula, a number, in var cell but I need is the formula string, like =SUM(O4,N4)
So, is this a bug, or am I not looking correctly, in which case what should I do to get exactly what has been written in the Cell?
Thank you

@xuri
Copy link
Member

xuri commented Mar 1, 2022

Thanks for your issue. Please use SetCellFormula to get the formula from the cell and use GetCellType to determine which cell is a formula cell.

@ffleader1
Copy link
Author

ffleader1 commented Mar 1, 2022

Thanks for your issue. Please use SetCellFormula to get the formula from the cell and use GetCellType to determine which cell is a formula cell.

You mean to use GetCellFormula right?
Well, the thing is if the Cell contains =SUM(O4,N4), then the formula will be O4+N4.
I need the formula string due to the fact that that my Cell has LET function, which cannot be parsed (yet), so I need the raw string formular to run it through a custom LET parser that I wrote.
But I cannot because if the formula has LET, it will not work properly. But I cannot get the raw string formular.
Basically, I just want to know how (or is it possible) to get the Raw string fomula.
Thank you.

@ffleader1
Copy link
Author

Any update on this?
I just want to get the raw raw formular, not the formula that has been passed. Thank you.

@pgalbavy-itrs
Copy link

I have possibly a related issue; I have 24-hour times in a column which even with RawCellValue set are returned without the leading zeros instead of the text "0050", for example.

@xuri
Copy link
Member

xuri commented Sep 9, 2022

Hi @pgalbavy-itrs, thanks for your feedback, could you provide your input file attachment without confidential info?

@pgalbavy-itrs
Copy link

pgalbavy-itrs commented Sep 12, 2022

Will try - it turned out the cell was formatted by the user with some weird combination of languages and numeric types. I will have to go find a copy of the XLSX file before they fixed it on our advice.

Found it; Will try to put value and format in it's own file - but under OneDrive cell format is:

image

Yes, we don't know who picked that either.

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