Bigman
Bigman

Reputation: 1473

Cannot resolve google.sheets in google sheets api

I am using Google Sheets API with NodeJS and trying out the simplest demo from https://developers.google.com/sheets/api/quickstart/nodejs

I am getting a runtime error "google.sheets is not a function". When I am inspecting, I got the debug screenshot below,

enter image description here

The google variable is from var google = require("googleapis");, which seems to load well(has a bunch of content inside). Of its properties there does not seem to have a "sheets" property, thus the executing result will say it is not a function.

No one is asking a similar question online. Did I miss a very obvious step of setting up?

Upvotes: 2

Views: 370

Answers (1)

Tobias M
Tobias M

Reputation: 1338

Change the import to:

var {google} = require("googleapis");

Upvotes: 1

Related Questions