theoephraim / node-google-spreadsheet

Google Sheets API wrapper for Javascript / Typescript
https://theoephraim.github.io/node-google-spreadsheet
The Unlicense
2.34k stars 390 forks source link

Number with formatting become a string #668

Open konser80 opened 1 year ago

konser80 commented 1 year ago

Hello!

Sometimes you have number formatting with a thousand separator like this: 2,400 And after reading it becomes a string "2,400" and not a number. It's a pity.

Maybe... Is it possible to use like a... range.getValues() instead of range.getDisplayValues() ? So we can keep cell type - number.

theoephraim commented 1 year ago

Using the cell-based methods, you can get both the raw value (the underlying number) and the "formatted value" (the string version with formatting rules applied).

The row-based API uses the much simplified spreadsheets.values api and while we could fetch the raw value vs formatted value, that api does not let you fetch both at the same time.

There is some related discussion here.

It would be a fairly large change of how the row-based methods work, and considering there is a workaround (use the cell-based methods) I don't think it will change soon.