Create a Target Project to Execute with the Apps Script API

Before you can begin the Android or iOS quickstarts, you need a target Apps Script project. The mobile quickstart code executes a function in this project remotely, and receives a response back.

Follow these steps to create a simple script project and enable it for API access.

Step 1: Create the script

  1. Create a new script project.
  2. Click on the "Untitled Project" title to rename the script. Name the script "Apps Script API Quickstart Target" and click OK.
  3. Replace the contents of the Code.gs file with the following:

    apps-script/execute/target.js
    /**
     * Return the set of folder names contained in the user's root folder as an
     * object (with folder IDs as keys).
     * @return {Object} A set of folder names keyed by folder ID.
     */
    function getFoldersUnderRoot() {
      var root = DriveApp.getRootFolder();
      var folders = root.getFolders();
      var folderSet = {};
      while (folders.hasNext()) {
        var folder = folders.next();
        folderSet[folder.getId()] = folder.getName();
      }
      return folderSet;
    }
  4. Save the project by selecting File > Save.

Step 2: Publish the script for execution

  1. In the code editor, select Publish > Deploy as API executable.
  2. In the dialog that opens, leave the Version as "New" and enter "Target-v1" into the text box. Click Deploy.

Step 3: Choose a quickstart

Each of these quickstarts use the Apps Script API to execute the script you just created:

Send feedback about...

Apps Script API
Apps Script API
Need help? Visit our support page.