addWorksheet method fails: this.isAuthActive is not a function
See original GitHub issueRunning the following code on Node.js v10.16.0:
const Gss = require('google-spreadsheet');
const { promisify } = require('util');
const creds = require('./client_secret.json');
const main = async () => {
const sheetId = '<sheet id>';
const doc = new Gss(sheetId);
await promisify(doc.useServiceAccountAuth)(creds);
const sheet = await promisify(doc.addWorksheet)({
title: 'test',
});
};
main();
fails with
(node:13279) UnhandledPromiseRejectionWarning: TypeError: this.isAuthActive is not a function
at GoogleSpreadsheet.addWorksheet (/home/niklash/standup-query-bot/bot/node_modules/google-spreadsheet/index.js:225:15)
google-spreadsheet version is: 2.0.7
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
workbook.addWorkSheet is not a function · Issue #472 - GitHub
I tried making a small demo file that would make two calls to the method that does the new ExcelJS.Workbook() - and it...
Read more >"Error in addWorksheet(wb, "sheet1") : First argument must be ...
The code you have shared doesn't throw any error in my case. The error message you have shared indicates that the workbook wb...
Read more >addWorksheet: Add a worksheet to a workbook in openxlsx
wb. A Workbook object to attach the new worksheet ; sheetName. A name for the new worksheet ; gridLines. A logical. If FALSE...
Read more >Excel workbook is not activated when you run a macro - Office
Provides a workaround for an issue that prevents the Workbook.Activate method from working as expected if the ScreenUpdating property is set ...
Read more >Excel.ActiveWorkBook.WorkSheets is not a function
This is the code the error is being thrown on. function ReadRow(rownum, columnstart, filename, sheetname, columnend) {. var filepath = "C:/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think: Before:
After:
@amrshakya The issue was that the promisified method did not have
this
bound which the function requires, i.e. I was trying to use the method like a static class method. Thus when I bound the doc asthis
using.call
it worked like an ordinary non-static method call. I supposedoc.useServiceAccountAuth
does not usethis
and that’s why it worked without the bound context. Classic javascript