Project Management

  • The Apps Script API enables the creation and modification of Apps Script projects from your application.

  • The API needs to be enabled before it can be used.

  • You can find the script project ID in the project settings of your Apps Script project.

  • The API allows for common project management operations such as creating new projects, retrieving project metadata and files, and updating project files.

The Apps Script API allows you to create and modify Apps Script projectsfrom your app. The examples on this page illustrate how some common projectmanagement operations can be achieved with the API.

NOTE: The Apps Script API must beenabledbefore usage.

In these examples, the placeholdersscriptIdis used to indicate where you would provide the script project ID. Follow thesteps below to find the script ID:

  1. In the Apps Script project, at the top left, clickProject Settings.
  2. Next to "Script ID," clickCopy.

Create a new Apps Script project

The followingprojects.createrequest creates a newstandalone script.

POST https://scriptmanagement.googleapis.com/v1/projects/
{  "title": "My Script"}

Retrieve project metadata

The followingprojects.getrequest gets the scriptproject's metadata.

GET https://scriptmanagement.googleapis.com/v1/projects/scriptId

The response consists of anobjectsuch as this one:

{  "scriptId": "scriptId",  "title": "My Title",  "parentId": "parentId",  "createTime": "2017-10-02T15:01:23.045123456Z",  "updateTime": "2017-10-02T15:01:23.045123456Z",  "creator": { "name": "Grant" },  "lastModifyUser": { "name": "Grant" },}

Retrieve project files

The followingprojects.getContentrequest gets the content of the script project, including the code source andmetadata for each script file.

GET https://scriptmanagement.googleapis.com/v1/projects/scriptId/content

The response consists of aContentobject such as this one:

{"scriptId":"scriptId","files":[{"name":"My Script","type":"SERVER_JS","source":"function hello(){\nconsole.log('Hello world');}","lastModifyUser":{"name":"Grant","email":"grant@example.com",},"createTime":"2017-10-02T15:01:23.045123456Z","updateTime":"2017-10-02T15:01:23.045123456Z","functionSet":{"values":["name":"helloWorld"]}},{"name":"appsscript","type":"JSON","source":"{\"timeZone\":\"America/New_York\",\"exceptionLogging\":\"CLOUD\"}","lastModifyUser":{"name":"Grant","email":"grant@example.com",},"createTime":"2017-10-02T15:01:23.045123456Z","updateTime":"2017-10-02T15:01:23.045123456Z"}]}

Update project files

The followingprojects.updateContentrequest updates the content of the specified script project. This content isstored as the HEAD version, and is used when the script is executed as an APIexecutable project.

PUT https://scriptmanagement.googleapis.com/v1/projects/scriptID/content
{"files":[{"name":"index","type":"HTML","source":"<html> <header><title>HTML Page</title></header> <body> My HTML </body> </html>"},{"name":"My Script","type":"SERVER_JS","source":"function hello(){\nconsole.log('Hello world');}",},{"name":"appsscript","type":"JSON","source":"{\"timeZone\":\"America/New_York\",\"exceptionLogging\":\"CLOUD\"}","lastModifyUser":{"name":"Grant","email":"grant@example.com",},"createTime":"2017-10-02T15:01:23.045123456Z","updateTime":"2017-10-02T15:01:23.045123456Z"}]}

The response consists of aContentobject such as this one:

{"scriptId":"scriptId","files":[{"name":"index","type":"HTML","source":"<html> <header><title>HTML Page</title></header> <body> My HTML </body> </html>","lastModifyUser":{"name":"Grant","email":"grant@example.com",},"createTime":"2017-10-02T15:01:23.045123456Z","updateTime":"2017-10-02T15:01:23.045123456Z"},{"name":"My Script","type":"SERVER_JS","source":"function hello(){\nconsole.log('Hello world');}","lastModifyUser":{"name":"Grant","email":"grant@example.com",},"createTime":"2017-10-02T15:01:23.045123456Z","updateTime":"2017-10-02T15:01:23.045123456Z","functionSet":{"values":["name":"helloWorld"]}},{"name":"appsscript","type":"JSON","source":"{\"timeZone\":\"America/New_York\",\"exceptionLogging\":\"CLOUD\"}","lastModifyUser":{"name":"Grant","email":"grant@example.com",},"createTime":"2017-10-02T15:01:23.045123456Z","updateTime":"2017-10-02T15:01:23.045123456Z"}]}

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.