Data format
Opened this issue · 5 comments
Hello, I find Range.getValue() is a double type no matter what the format of the range in spreadsheet is. I set it to text, it is also double. I think it is a problem. By the way, can you refer functions of range to return type what I want. For example, Range.getIntValue will give me a integer no matter it is a text or double or other format of the range. Now I have to deal with null pointer and type converting.
Thanks for your report! Please ensure you have provided enough info in order to recreate the issue, including the problematic ODS File.' first issue
Thanks for your report! Please ensure you have provided enough info in order to recreate the issue, including the problematic ODS File.' first issue
Ok, I will create a demo project later.
For the first problem, I create a demo to explain it. You can check https://github.com/yangshulin2019/SODS-Example. As in test.ods file, A1 is a number and B1 is a text format, but when I print the value, it gives double type 1.0 and 123456.0, the results should be 1 and 123456.
For the second one, I agree with you.
By the way, I suggest Sheet.getLastRow and Sheet.getDataRange to return valid data, not the whole sheet data. It includes many null values and it is not useful for users. You can just reference Google Appsscript, Sheet.getDataRange() return only valid data.
I see your point, but the answer of SODS is correct. There are not integers in an ODS file, every number is float:
Of course if you wanted to show them to the user, you could skip the decimal point in these specific cases.
About the content, getLastRow() tries to get you the last row with useful data in contrast to getMaxRows(). I guess it could fail if these rows have a specific style formatting associated (but not a value). I guess the whole system of rows/column need to be reworked.
I guess it´s a better idea to return valid data with getDataRange(). Meanwhile, the same bebaviour could be recreated with:
getRange(0,0,getLastRows(),getLastColumns());
At least in theory. I am aware it could give you unreal numbers because the style formatting.
Good stuff, let´s can we solve these problems :)
Thanks