pwmetrics
pwmetrics copied to clipboard
Google sheets API error?
Config / CLI options
When trying to upload results to Google Sheets, I get that the API returned an error -- google.sheets is not a function. Is this related to maybe updates in the sheets API?
Steps to reproduce.
Stack trace
Screenshot
The API returned an error: TypeError: google.sheets is not a function
Error: TypeError: google.sheets is not a function
at Object.appendResults (/Users/tim/htdocs/quality-of-life-dashboard/node_modules/pwmetrics/lib/sheets/gsheets.js:51:15)
at Sheets.appendResultsToGSheets (/Users/tim/htdocs/quality-of-life-dashboard/node_modules/pwmetrics/lib/sheets/index.js:61:27)
at async PWMetrics.start (/Users/tim/htdocs/quality-of-life-dashboard/node_modules/pwmetrics/lib/index.js:77:17)
Environment
pwmetricsversion: 4.2.3- Chrome version:
- OS version:
I got the same error. If you go to gsheets.js and change
const google = require('googleapis');
to
const { google } = require('googleapis');
...it solves this problem, but then I run into a bunch of other problems (related to OAuth and callbacks not being defined and google's various packages not interacting with each other the way they're supposed to) which may or may not even be related. So, you can try this! But no promises it'll work, because it's not working for me haha
Update! @timstallmann I just added a PR with the google npm package updates that solved this for me. take a look if you're still trying to get this working
@csb324 :stars: :fireworks: this is the best news I've gotten all day! I think the linter is just choking on the async keyword in line 98 of sheets.js.
Hmm I'm still getting now an invalid grant API response. @csb324 were you able to get this to work all the way through with an actual google sheet upload? I'm wondering if it's a problem on my end..
Hi @timstallmann & @csb324 . Did this issue get resolved? I cloned the work done in @csb324 PR, recompiled the TS and I am getting error:
The API returned an error: Error: Unable to parse range: pwmetrics for demo!A1:C1 Error: Error: Unable to parse range: pwmetrics for demo!A1:C1 at GSheets.appendResults in \lib\sheets\gsheets.js\
I apologise. I had the wrong config
Oh nice! @nathanmillar16 how did you fix your config? I'm still stuck on this error.
Sorry for late reply. I had the table name in my package-config incorrect. It is supposed to match a tab within the sheets you're adding too.