'Convert cell from text to value

I extrapolated a file in extension .xlsx
and I import in Google Sheets
but the value is in text format but I need in value format
How could I change the format with a script ?

value in text format ( I know because if i do =isnumber() the result is "false" )

i do this

for (var y=0; y< lastRow ; y++){
    Cronistoria.getRange(y,21);
    Cronistoria.getCurrentCell(y,21).setFormula('=value()');

there are a word for example "parseInt"? or other?



Solution 1:[1]

Google Apps Script uses JavaScript as programming language.

  • A Google Sheets "text", in JavaScript is a string.
  • A Google Sheets "value", in JavaScript is a number.

In JavaScript, to convert a string into a number you could use Number, i.e. Number('1.3') returns 1.3, parseInt('1.3') returns 1.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rubén