Skip to content Skip to sidebar Skip to footer

Google Spreadsheet Script Changes Comma To Full-stop Upon Reading From A Cell?

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

Solution 1:

Issue:

  • Some locations use , 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).

Solution(s):

  • Set your locale properly, if you're going to use ,s as commas and not as decimal separators OR
  • Input numbers as text. Use ' before inputting data in each cell. '135,136 OR
  • Send inputs as Text. =TEST(TO_TEXT(A1)) OR
  • Use range#getDisplayValues() instead.

Solution 2:

The A Column where this data is stored, it's format should be changed and that would solve the issue. Select A Column --> Format --> Number -- Plain Text. Changing the format will serve the purpose.

Hope it could help!.

Post a Comment for "Google Spreadsheet Script Changes Comma To Full-stop Upon Reading From A Cell?"