Closed kjakub closed 10 years ago
@kjakub You're doing nothing wrong. @jpillora It's going wrong here in line 31 in lib/util.js
//parse num value (if it's not a date)
if(cell.numericValue && cell.numericValue === cell.inputValue || isNaN(Date.parse(cell.inputValue)))
return exports.num(cell.numericValue); //<= line 31
else //use string value
return cell.inputValue;
Here's how the data from google spreadsheet looks like for a number and a string.
"gs$cell": {
"row": "1",
"col": "1",
"inputValue": "123",
"numericValue": "123.0",
"$t": "123"
},
"gs$cell": {
"row": "1",
"col": "2",
"inputValue": "qwerty",
"$t": "qwerty"
}
For the string there's no numericValue, but isNaN(Date.parse("qwerty"))
equals to true, then you do:
return exports.num(cell.numericValue);
but that should be:
return exports.num(cell.inputValue);
Yep! Bug! PR anyone :)? Currently on vacation though I should be able to merge and republish
On Thursday, February 13, 2014, Christiaan Westerbeek < notifications@github.com> wrote:
@kjakub https://github.com/kjakub You're doing nothing wrong. @jpillorahttps://github.com/jpilloraIt's going wrong here in line 31 in lib/util.js
//parse num value (if it's not a date) if(cell.numericValue && cell.numericValue === cell.inputValue || isNaN(Date.parse(cell.inputValue))) return exports.num(cell.numericValue); //<= line 31 else //use string value return cell.inputValue;
Here's how the data from google spreadsheet looks like for a number and a string.
"gs$cell": { "row": "1", "col": "1", "inputValue": "123", "numericValue": "123.0", "$t": "123" }, "gs$cell": { "row": "1", "col": "2", "inputValue": "qwerty", "$t": "qwerty" }
For the string there's no numericValue, but isNaN(Date.parse("qwerty"))equals to true, then you do:
return exports.num(cell.numericValue);
but that should be:
return exports.num(cell.inputValue);
Reply to this email directly or view it on GitHubhttps://github.com/jpillora/node-edit-google-spreadsheet/issues/19#issuecomment-34917177 .
Yeah I could but it's one word to change. Can't you do the commit using the editor on Github.com? It's easy.
Yep! Bug! PR anyone :)? Currently on vacation though I should be able to merge and republish
On Thursday, February 13, 2014, Christiaan Westerbeek < notifications@github.com> wrote:
@kjakub https://github.com/kjakub You're doing nothing wrong. @jpillorahttps://github.com/jpilloraIt's going wrong here in line 31 in lib/util.js
//parse num value (if it's not a date) if(cell.numericValue && cell.numericValue === cell.inputValue || isNaN(Date.parse(cell.inputValue))) return exports.num(cell.numericValue); //<= line 31 else //use string value return cell.inputValue;
Here's how the data from google spreadsheet looks like for a number and a string.
"gs$cell": { "row": "1", "col": "1", "inputValue": "123", "numericValue": "123.0", "$t": "123" }, "gs$cell": { "row": "1", "col": "2", "inputValue": "qwerty", "$t": "qwerty" }
For the string there's no numericValue, but isNaN(Date.parse("qwerty"))equals to true, then you do:
return exports.num(cell.numericValue);
but that should be:
return exports.num(cell.inputValue);
Reply to this email directly or view it on GitHub< https://github.com/jpillora/node-edit-google-spreadsheet/issues/19#issuecomment-34917177
.
Reply to this email directly or view it on GitHubhttps://github.com/jpillora/node-edit-google-spreadsheet/issues/19#issuecomment-34928374 .
Same issue here.
I am getting 0 instead of expected string from spreadsheet. What I am doing wrong?
Found rows: { '1': { '1': '1243', '2': '555', '3': 0 } } Info: { spreadsheetId: 'dsds', worksheetId: 'od6', worksheetTitle: 'Sheet1', worksheetUpdated: Wed Feb 12 2014 22:56:33 GMT+0700 (ICT), totalCells: 3, totalRows: 1, lastRow: 1, nextRow: 2 }