Hi,
I am trying to set up a way to import data from a large Google Sheet to a Wix database in a specific order. The sheet is a history of race results for our cycling club going back 20 years so is at around 10000 rows, and growing.
I’ve used the built in NPM package for Google Sheets and it’s linking with the sheet properly for the initial bit, but then I get a hang or timeout on the main data request. I know the site is linking to the sheet correctly as the first step is to get the last row number from a specific cell. Then it sends a request for all rows up to the last row, but this is where it seems to be going wrong.
This is my code so far:
export async function getResults() {
console.log(“getting results”)
let resultsArray = [];
let event = [];
let eventArray = [];
try {
let rowCountCell = "config!B2" //get address of the results range in the sheet
let sheetId = await getSecretSheetId()
let searchRange = await getValues(sheetId, rowCountCell)
if(searchRange.status===200){
let rowCount = [searchRange.data](http://searchRange.data) .values[0][0]
console.log (rowCount)
let rangeAddress = `Master Data - without range imports!A3:Q${rowCount}`
console.log(rangeAddress)
await getValues(sheetId, rangeAddress)
.then((data) =>{
console.log(data)
})
.catch((err=>{
return Promise.reject('Get values failed. Info: ' + err);
}))
}
} catch (err) {
return Promise.reject('Get values failed. Info: ' + err);
}
}
I have tried breaking the requests down to a series of requests of about 2000 rows. This works for about 2 iterations before I get the same problem. I’m not getting any error message in the console, the code is just hanging.
Any help much appreciated!