So, I'm trying to read data from a cell in Google Spreadsheet's script and something's not right for me. I made a quick test function that takes the data from the cell, turns it to a string and returns the result, like so:
function TEST(str)
{
return str.toString();
}
Then I made two test cells:
A1 with "17"
A2 with "135,136"
A3 with "1,11,29,43,68,74,109,122"
Then I called my function and I'm baffled by results
TEST(A1) returns "17"
TEST(A2) returns "135.136"
TEST(A3) returns "1,11,29,43,68,74,109,122"
So it seems that if there is exactly one comma it gets cast to a full-stop instead but if there are multiple none of them get replaced. What is going on and how can I read data from a cell as a string with 100% certainty that it won't get changed in any way?
,
as decimal separator. So, 135,136
is a valid number(=135.136
). But, 1,11,29,43,68,74,109,122
is not. Valid numbers are by default aligned to the right of the cell(Clear cell formatting to witness).,
s as commas and not as decimal separators OR'
before inputting data in each cell. '135,136
OR=TEST(TO_TEXT(A1))
ORrange#getDisplayValues()
instead.