excelize
excelize copied to clipboard
GetCellValue does not return raw value, even with the option RawCellValue: true
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
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.
Thanks for your issue. Please use
SetCellFormula
to get the formula from the cell and useGetCellType
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.
Any update on this? I just want to get the raw raw formular, not the formula that has been passed. Thank you.
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.
Hi @pgalbavy-itrs, thanks for your feedback, could you provide your input file attachment without confidential info?
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:
Yes, we don't know who picked that either.