Home > OS >  Convert cell from text to value
Convert cell from text to value

Time:03-22

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?

CodePudding user response:

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.

CodePudding user response:

ok thanks i attached script's picture where i could write "Number" ? when i getrange? or other place?

"var costoXquantita = Cronistoria.getRange(5,rigacosto,lastRow ).getValues();"

enter image description here

really thanks

  • Related