node-google-spreadsheet
node-google-spreadsheet copied to clipboard
using loadCells with GridRangeObject. Data inside GRO seems to get "lost"
*** post complete ***
So I have trapped the uncaught error, and am writing this from the output:
the stack looks like (top at the top):
(anonymous)
arrayEach
forEach
_fillCellData
_updateOrCreateSheet
(anonymous)
arrayEach
forEach
loadCells
inside the loadCells frame, this is the value of filtersArray
, defined on line 314 in GoogleSpreadsheet.js
[
{
sheetId: 0,
startRowIndex: 20,
endRowIndex: 20,
startColumnIndex: 0,
endColumnIndex: 12
}
]
by the time we arrive at _fillCellData
, line 57, GoogleSpreadsheetWorksheet.js, we have this:
_fillCellData(dataRanges) {
_.each(dataRanges, (range) => { // range = {startRow: 20, columnMetaData: Array(12)}
const startRow = range.startRow || 0; // startRow = 20
const startColumn = range.startColumn || 0; // startColumn = 0
// this next assignment causes an error:
const numRows = range.rowMetadata.length; // rowMetadata = undefined
const numColumns = range.columnMetadata.length;
OK, I worked out the bug.
rowMetadata
is not loaded if there is only 1 row being loaded, using a GridRangeObject
I have changed my code to load 2 rows.
[
{
sheetId: 0,
startRowIndex: 20,
endRowIndex: 21,
startColumnIndex: 0,
endColumnIndex: 12
}
]
Hi @christopherreay - do you have any idea if this seemed to be an issue with the google API or this module?
Not the faintest idea my friend :) I didnt look through the code in detail, I was on a deadline. I can try and have a look sometime in the next couple of weeks if you would like?
All good - I'll take a look. Thanks!
I can't reproduce this. If this is still an issue, please reopen with more details.