I've been trying to set up a node application with the Google Sheets API, but when initializing as per the documentation I get the following error:
TypeError: google.auth.GoogleAuth is not a constructor
Using the below code:
const {google} = require('googleapis');
const auth = new google.auth.GoogleAuth({
keyFile: 'credentials.json',
scopes: ['https://www.googleapis.com/auth/spreadsheets']
});
I've tried looking everywhere but haven't been able to find a solution.
To clarify I have installed googleapis with npm in the project as well
I had the same problem and updating the googleapis library fixed the issue. Run npm i googleapis@latest and try again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With