question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable Advanced Services for Apps Script projects via CLI

See original GitHub issue

Expected Behavior

To use Google APIs (Advanced Services) in Apps Script, you must enable APIs in the online editor at script.google.com > Resources > Advanced Google Services...

You should be able to setup a project without having to go to the editor. I propose a function to enable APIs in clasp like the UI.

Commands

clasp apis list
clasp apis enable "drive.googleapis.com"
clasp apis disable "drive.googleapis.com"
  • list would list all Google API serviceIds
  • enable/disable a API for the Cloud project

Eventually autocomplete:

clasp apis enable # select from list of all Google APIs that aren't enabled
clasp apis disable # select from list of enabled APIs in the manifest

API

These commands would use the serviceuser.projects.services API. It would require a personal Cloud project. projects/project-id-0486239153690933627/services/drive.googleapis.com

EDIT: User serviceusage not serviceuser since that’s the newer API.

Result

The result of enabling an advanced service via the UI is:

  1. Enabling the API for your Cloud Console project
  2. Adding some data to your appsscript.json.
  "dependencies": {
    "enabledAdvancedServices": [{
      "userSymbol": "AdSenseOrWhatever",
      "serviceId": "adsense",
      "version": "v1.4"
    }]
  }

Actual Behavior

Users have to go to script.google.com to enable advanced services.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
grantcommented, Jun 15, 2018

@rdoursenaud Advanced service aren’t disabled on push. You need to pull after you enable an advanced service, because it changes the appsscript.json file. LMK if you’re still seeing an error.

I should document this more.

1reaction
grantcommented, Nov 26, 2018

This feature has been added into master. It’ll appear in clasp@2 in December. Marking as fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Google services | Apps Script
Enable advanced services · Open the GCP project associated with your script in the Google API Console. · At the top of the...
Read more >
Advanced Development Process with Apps Script
This project, “node-google-apps-script”, is a Node.js based command-line interface (CLI) that uses Google Drive API to update Apps Script ...
Read more >
clasp - The Apps Script CLI - Google Codelabs
The Apps Script CLI, or clasp , is a tool that lets you to create, edit, and deploy Apps Script projects locally. It...
Read more >
Enabling Advanced Google Service in Apps Script for Google ...
1. There is no cost to enabling the Google Drive API. – Alan Wells. Oct 5, 2019 at 19:49 · @AlanWells - I'd...
Read more >
How To Script Google Advanced Services - ADocLib
The Apps Script CLI or clasp is a tool that lets you to create edit and deploy Apps for products like Sheets Docs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found