GhostKU
GhostKU

Reputation: 2108

How to rename project with Google Apps Script API

Is there any way to rename Google Apps Script project using API? I can't find any appropriate method for this.

UPD: I want to change Project's name like

enter image description here

enter image description here

Upvotes: 1

Views: 1791

Answers (1)

Tanaike
Tanaike

Reputation: 201643

You can modify the project name of the container-bound script type using Drive API. In order to use this, please retrieve the project ID, retrieve access token and enable Drive API.

End point :

PATCH https://www.googleapis.com/drive/v3/files/### project ID ###

Request body :

{
 "name": "### Modified name ###"
}

Note :

  • In Google Drive, the project name is the same to the filename of the project.
  • Unfortunately, in the current stage, the project ID cannot be retrieved from Spreadsheet. But by the recent update, the file ID of Spreadsheet got to be able to be retrieved from the project of the container-bound script type. I would like to expect that the project ID will be retrieved from Spreadsheet in the future.

Reference :

Upvotes: 2

Related Questions