Memphis Meng
Memphis Meng

Reputation: 1671

How to use google API in Apps Scripts on Google Sheet?

I know my question sounds a bit mouthful, so just let me make my point clear: I need to do something like bringing data from Google Sheet to AWS (i.e. Athena), or vice versa.

However, because Google API is in need anyway, I surprisingly found that require() is not even a function in such kind of JS' twin-like language at all. Therefore, how can we use any third-party libraries on it?

Example (github repo):

const {google} = require('googleapis');

Upvotes: 2

Views: 759

Answers (1)

Amit Agarwal
Amit Agarwal

Reputation: 11268

You can use Gmail, Calendar, Drive, and most other Google Workspaces APIs in Apps Script by enabling Advanced Services.

  • Open the Apps Script project.
  • At the left, click Editor code.
  • At the left, next to Services, click Add a service add.
  • Select an advanced Google service and click Add.

Here's an example on how to use the Drive API inside Apps Script.

Upvotes: 1

Related Questions