Apps Script API के साथ फ़ंक्शन एक्ज़ीक्यूट करना

Google Apps Script API एक scripts.run तरीका उपलब्ध कराता है, जो चुने गए Apps Script फ़ंक्शन को रिमोट तरीके से एक्ज़ीक्यूट करता है. आप कॉलिंग ऐप्लिकेशन में इस तरीके का इस्तेमाल अपने किसी स्क्रिप्ट प्रोजेक्ट में रिमोट तरीके से चलाने और जवाब पाने के लिए भी कर सकते हैं.

ज़रूरी शर्तें

कॉल करने वाले ऐप्लिकेशन के लिए, scripts.run तरीके का इस्तेमाल करने से पहले, आपको ये ज़रूरी शर्तें पूरी करनी होंगी. आपको ये काम करने होंगे:

  • स्क्रिप्ट प्रोजेक्ट को एपीआई एक्ज़ीक्यूटेबल एपीआई के तौर पर डिप्लॉय करें. ज़रूरत के हिसाब से प्रोजेक्ट को डिप्लॉय, डिप्लॉय, और फिर से डिप्लॉय किया जा सकता है.

  • लागू करने के लिए, सही स्कोप वाला OAuth टोकन दें. इस OAuth टोकन में स्क्रिप्ट में इस्तेमाल किए जाने वाले सभी स्कोप शामिल होने चाहिए, न कि सिर्फ़ वे दायरे जिन्हें स्क्रिप्ट में इस्तेमाल किया जाता है. तरीके के रेफ़रंस में, अनुमति के दायरे की पूरी सूची देखें.

  • पक्का करें कि स्क्रिप्ट और कॉलिंग ऐप्लिकेशन का OAuth2 क्लाइंट, एक जैसा Google Cloud प्रोजेक्ट शेयर करता हो. Cloud प्रोजेक्ट, स्टैंडर्ड Cloud प्रोजेक्ट होना चाहिए; Apps Script प्रोजेक्ट के लिए बनाए गए डिफ़ॉल्ट प्रोजेक्ट काफ़ी नहीं हैं. आपके पास नए स्टैंडर्ड Cloud प्रोजेक्ट या किसी मौजूदा प्रोजेक्ट का इस्तेमाल करने का विकल्प है.

  • क्लाउड प्रोजेक्ट में Google Apps Script API चालू करें.

scripts.run तरीका

scripts.run इस तरीके को चलाने के लिए, पहचान करने वाली मुख्य जानकारी की ज़रूरत होती है:

स्क्रिप्ट को डेवलपमेंट मोड में चलाने के लिए, वैकल्पिक रूप से कॉन्फ़िगर भी किया जा सकता है. यह मोड, स्क्रिप्ट प्रोजेक्ट के सबसे नए वर्शन के बजाय सेव किए गए वर्शन पर काम करता है. ऐसा करने के लिए, अनुरोध के मुख्य हिस्से में devMode बूलियन को true पर सेट करें. स्क्रिप्ट का मालिक ही इसे डेवलपमेंट मोड में लागू कर सकता है.

पैरामीटर के डेटा टाइप को हैंडल करना

आम तौर पर, Apps Script API scripts.run तरीके का इस्तेमाल करने पर, Apps Script में फ़ंक्शन पैरामीटर के तौर पर डेटा भेजा जाता है. साथ ही, फ़ंक्शन रिटर्न वैल्यू के तौर पर डेटा को वापस लाया जाता है. एपीआई सिर्फ़ बेसिक टाइप वाली वैल्यू ले सकता है और उन्हें दिखा सकता है: स्ट्रिंग, अरे, ऑब्जेक्ट, संख्याएं, और बूलियन. ये JavaScript की बुनियादी जानकारी से मिलते-जुलते होते हैं. ज़्यादा जटिल Apps Script ऑब्जेक्ट, जैसे कि दस्तावेज़ या शीट को एपीआई की मदद से, स्क्रिप्ट प्रोजेक्ट में या उससे पास नहीं किया जा सकता.

जब कॉल करने के लिए इस्तेमाल किया जाने वाला आपका ऐप्लिकेशन, Java जैसी ज़्यादा जानकारी वाली भाषा में लिखा जाता है, तो यह पैरामीटर के तौर पर सामान्य ऑब्जेक्ट की सूची या कलेक्शन के तौर पर पास होता है, जो इन बेसिक टाइप से मेल खाता है. कई मामलों में, आसान टाइप के कन्वर्ज़न अपने-आप लागू किए जा सकते हैं. उदाहरण के लिए, नंबर पैरामीटर लेने वाला फ़ंक्शन, Java Double या Integer या Long ऑब्जेक्ट को पैरामीटर के तौर पर बिना किसी अतिरिक्त हैंडलिंग के दिया जा सकता है.

जब एपीआई फ़ंक्शन रिस्पॉन्स देता है, तो दिखाई गई वैल्यू को इस्तेमाल करने से पहले, आपको अक्सर सही वैल्यू टाइप में कास्ट करना पड़ता है. यहां Java पर आधारित कुछ उदाहरण दिए गए हैं:

  • एपीआई के ज़रिए Java ऐप्लिकेशन के लिए लौटाए गए नंबर, java.math.BigDecimal ऑब्जेक्ट के तौर पर आते हैं. इसलिए, इन्हें ज़रूरत के मुताबिक Doubles या int टाइप में बदलना पड़ सकता है.
  • अगर Apps Script फ़ंक्शन, स्ट्रिंग का अरे दिखाता है, तो Java ऐप्लिकेशन, रिस्पॉन्स को List<String> ऑब्जेक्ट में कास्ट करता है:

    List<String> mylist = (List<String>)(op.getResponse().get("result"));
    
  • अगर आपको Bytes का कलेक्शन दिखाना है, तो इसे Apps Script फ़ंक्शन में Base64 स्ट्रिंग के तौर पर एन्कोड करना और इसके बजाय वह स्ट्रिंग लौटाना आसान हो सकता है:

    return Utilities.base64Encode(myByteArray); // returns a String.
    

नीचे दिए गए उदाहरण के तौर पर दिए गए कोड के सैंपल में, एपीआई के रिस्पॉन्स को समझने के तरीके बताए गए हैं.

सामान्य प्रक्रिया

Apps Script फ़ंक्शन को एक्ज़ीक्यूट करने के लिए, Apps Script API का इस्तेमाल करने की सामान्य प्रोसेस यहां दी गई है:

पहला चरण: सामान्य Cloud प्रोजेक्ट सेट अप करना

स्क्रिप्ट और कॉलिंग ऐप्लिकेशन, दोनों को एक ही Cloud प्रोजेक्ट शेयर करना होगा. यह Cloud प्रोजेक्ट, कोई मौजूदा प्रोजेक्ट हो सकता है. इसके अलावा, इस काम के लिए बनाया गया कोई नया प्रोजेक्ट भी हो सकता है. Cloud प्रोजेक्ट बनाने के बाद, आपको उसका इस्तेमाल करने के लिए, अपना स्क्रिप्ट प्रोजेक्ट बदलना होगा.

दूसरा चरण: स्क्रिप्ट को लागू किए जा सकने वाले एपीआई के तौर पर डिप्लॉय करें

  1. आपको जिस फ़ंक्शन का इस्तेमाल करना है उसके साथ Apps Script प्रोजेक्ट खोलें.
  2. सबसे ऊपर दाईं ओर, डिप्लॉय करें > नया डिप्लॉयमेंट पर क्लिक करें.
  3. इसके बाद, खुलने वाले डायलॉग बॉक्स में, 'डिप्लॉयमेंट टाइप चालू करें' > एपीआई एक्ज़िक्यूटेबल पर क्लिक करें.
  4. "जिनके पास ऐक्सेस है" ड्रॉप-डाउन मेन्यू में, वे उपयोगकर्ता चुनें जिन्हें Apps Script API का इस्तेमाल करके, स्क्रिप्ट के फ़ंक्शन को कॉल करने की अनुमति है.
  5. डिप्लॉय करें पर क्लिक करें.

तीसरा चरण: कॉल करने के लिए इस्तेमाल होने वाले ऐप्लिकेशन को कॉन्फ़िगर करें

कॉल करने वाले ऐप्लिकेशन को Apps Script API को चालू करना होगा और OAuth के लिए ज़रूरी शर्तें सेट करनी होंगी. इसके बाद ही, इसका इस्तेमाल किया जा सकेगा. ऐसा करने के लिए, आपके पास Cloud प्रोजेक्ट का ऐक्सेस होना चाहिए.

  1. वह Cloud प्रोजेक्ट कॉन्फ़िगर करें जिसका इस्तेमाल, कॉल करने वाले ऐप्लिकेशन और स्क्रिप्ट कर रहे हैं. ऐसा करने के लिए, यह तरीका अपनाएं:
    1. Cloud प्रोजेक्ट में Apps Script API को चालू करें.
    2. उस स्क्रीन को कॉन्फ़िगर करें जहां OAuth के लिए सहमति दी जाती है.
    3. OAuth क्रेडेंशियल बनाएं.
  2. स्क्रिप्ट प्रोजेक्ट खोलें और बाईं ओर, खास जानकारी पर क्लिक करें.
  3. प्रोजेक्ट OAuth के दायरे में जाकर, स्क्रिप्ट के लिए ज़रूरी सभी स्कोप रिकॉर्ड करें.
  4. कॉलिंग ऐप्लिकेशन कोड में, एपीआई कॉल के लिए स्क्रिप्ट OAuth ऐक्सेस टोकन जनरेट करें. यह कोई ऐसा टोकन नहीं है जिसका इस्तेमाल एपीआई अपने-आप करता है. इसके बजाय, स्क्रिप्ट को एक्ज़ीक्यूट करते समय इसकी ज़रूरत होती है. इसे Cloud प्रोजेक्ट के क्लाइंट आईडी और आपके रिकॉर्ड किए गए स्क्रिप्ट के दायरों का इस्तेमाल करके बनाया जाना चाहिए.

    Google की क्लाइंट लाइब्रेरी से, इस टोकन को बनाने और ऐप्लिकेशन के लिए OAuth को मैनेज करने में काफ़ी मदद मिल सकती है. आम तौर पर, इससे आपको स्क्रिप्ट के स्कोप का इस्तेमाल करके, हाई-लेवल "क्रेडेंशियल" ऑब्जेक्ट बनाने की सुविधा मिलती है. स्कोप की सूची में से क्रेडेंशियल ऑब्जेक्ट बनाने के उदाहरण देखने के लिए, Apps Script API के क्विकस्टार्ट लेख पढ़ें.

चौथा चरण: script.run का अनुरोध करना

कॉल करने वाले ऐप्लिकेशन को कॉन्फ़िगर करने के बाद, scripts.run कॉल किए जा सकते हैं. हर एपीआई कॉल में ये चरण शामिल होते हैं:

  1. स्क्रिप्ट आईडी, फ़ंक्शन के नाम, और सभी ज़रूरी पैरामीटर का इस्तेमाल करके, एपीआई अनुरोध बनाएं.
  2. scripts.run को कॉल करें और हेडर में बनाया गया स्क्रिप्ट OAuth टोकन शामिल करें (अगर बुनियादी POST अनुरोध का इस्तेमाल किया जा रहा है) या स्क्रिप्ट के दायरे के साथ बनाए गए क्रेडेंशियल ऑब्जेक्ट का इस्तेमाल करें.
  3. स्क्रिप्ट को एक्ज़ीक्यूट करने की अनुमति दें. स्क्रिप्ट को लागू होने में छह मिनट तक लग सकते हैं, इसलिए आपके ऐप्लिकेशन को भी इसकी अनुमति देनी चाहिए.
  4. पूरा होने के बाद, स्क्रिप्ट फ़ंक्शन कोई ऐसी वैल्यू दिखा सकता है जिसे एपीआई ऐप्लिकेशन को वापस तब डिलीवर करता है, जब वैल्यू काम करने वाले टाइप की हो.

यहां script.run एपीआई कॉल के उदाहरण दिए गए हैं.

एपीआई अनुरोध के उदाहरण

नीचे दिए गए उदाहरणों में, उपयोगकर्ता की रूट डायरेक्ट्री में मौजूद फ़ोल्डर की सूची को प्रिंट करने के लिए, Apps Script फ़ंक्शन को कॉल करने का तरीका बताया गया है. इससे, अलग-अलग भाषाओं में Apps Script एपीआई को रन करने का अनुरोध किया जा सकता है. लागू किए गए फ़ंक्शन वाले Apps Script प्रोजेक्ट का स्क्रिप्ट आईडी, जहां ENTER_YOUR_SCRIPT_ID_HERE के साथ दिखाया जाना चाहिए वहां यह जानकारी दी जानी चाहिए. ये उदाहरण, अलग-अलग भाषाओं के लिए Google API क्लाइंट लाइब्रेरी पर निर्भर करते हैं.

टारगेट स्क्रिप्ट

इस स्क्रिप्ट का फ़ंक्शन, Drive API का इस्तेमाल करता है.

स्क्रिप्ट होस्ट करने वाले प्रोजेक्ट में, आपको Drive API चालू करना होगा.

इसके अलावा, कॉल करने वाले ऐप्लिकेशन को OAuth क्रेडेंशियल भेजने होंगे. इन क्रेडेंशियल में, Drive का यह दायरा शामिल होगा:

  • https://www.googleapis.com/auth/drive

उदाहरण के तौर पर दिए गए ऐप्लिकेशन, इस स्कोप का इस्तेमाल करके OAuth के लिए क्रेडेंशियल ऑब्जेक्ट बनाने के लिए, Google क्लाइंट लाइब्रेरी का इस्तेमाल करते हैं.

/**
 * 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() {
  const root = DriveApp.getRootFolder();
  const folders = root.getFolders();
  const folderSet = {};
  while (folders.hasNext()) {
    const folder = folders.next();
    folderSet[folder.getId()] = folder.getName();
  }
  return folderSet;
}

Java


/**
 * Create a HttpRequestInitializer from the given one, except set
 * the HTTP read timeout to be longer than the default (to allow
 * called scripts time to execute).
 *
 * @param {HttpRequestInitializer} requestInitializer the initializer
 *                                 to copy and adjust; typically a Credential object.
 * @return an initializer with an extended read timeout.
 */
private static HttpRequestInitializer setHttpTimeout(
    final HttpRequestInitializer requestInitializer) {
  return new HttpRequestInitializer() {
    @Override
    public void initialize(HttpRequest httpRequest) throws IOException {
      requestInitializer.initialize(httpRequest);
      // This allows the API to call (and avoid timing out on)
      // functions that take up to 6 minutes to complete (the maximum
      // allowed script run time), plus a little overhead.
      httpRequest.setReadTimeout(380000);
    }
  };
}

/**
 * Build and return an authorized Script client service.
 *
 * @param {Credential} credential an authorized Credential object
 * @return an authorized Script client service
 */
public static Script getScriptService() throws IOException {
  Credential credential = authorize();
  return new Script.Builder(
      HTTP_TRANSPORT, JSON_FACTORY, setHttpTimeout(credential))
      .setApplicationName(APPLICATION_NAME)
      .build();
}

/**
 * Interpret an error response returned by the API and return a String
 * summary.
 *
 * @param {Operation} op the Operation returning an error response
 * @return summary of error response, or null if Operation returned no
 * error
 */
public static String getScriptError(Operation op) {
  if (op.getError() == null) {
    return null;
  }

  // Extract the first (and only) set of error details and cast as a Map.
  // The values of this map are the script's 'errorMessage' and
  // 'errorType', and an array of stack trace elements (which also need to
  // be cast as Maps).
  Map<String, Object> detail = op.getError().getDetails().get(0);
  List<Map<String, Object>> stacktrace =
      (List<Map<String, Object>>) detail.get("scriptStackTraceElements");

  java.lang.StringBuilder sb =
      new StringBuilder("\nScript error message: ");
  sb.append(detail.get("errorMessage"));
  sb.append("\nScript error type: ");
  sb.append(detail.get("errorType"));

  if (stacktrace != null) {
    // There may not be a stacktrace if the script didn't start
    // executing.
    sb.append("\nScript error stacktrace:");
    for (Map<String, Object> elem : stacktrace) {
      sb.append("\n  ");
      sb.append(elem.get("function"));
      sb.append(":");
      sb.append(elem.get("lineNumber"));
    }
  }
  sb.append("\n");
  return sb.toString();
}

public static void main(String[] args) throws IOException {
  // ID of the script to call. Acquire this from the Apps Script editor,
  // under Publish > Deploy as API executable.
  String scriptId = "ENTER_YOUR_SCRIPT_ID_HERE";
  Script service = getScriptService();

  // Create an execution request object.
  ExecutionRequest request = new ExecutionRequest()
      .setFunction("getFoldersUnderRoot");

  try {
    // Make the API request.
    Operation op =
        service.scripts().run(scriptId, request).execute();

    // Print results of request.
    if (op.getError() != null) {
      // The API executed, but the script returned an error.
      System.out.println(getScriptError(op));
    } else {
      // The result provided by the API needs to be cast into
      // the correct type, based upon what types the Apps
      // Script function returns. Here, the function returns
      // an Apps Script Object with String keys and values,
      // so must be cast into a Java Map (folderSet).
      Map<String, String> folderSet =
          (Map<String, String>) (op.getResponse().get("result"));
      if (folderSet.size() == 0) {
        System.out.println("No folders returned!");
      } else {
        System.out.println("Folders under your root folder:");
        for (String id : folderSet.keySet()) {
          System.out.printf(
              "\t%s (%s)\n", folderSet.get(id), id);
        }
      }
    }
  } catch (GoogleJsonResponseException e) {
    // The API encountered a problem before the script was called.
    e.printStackTrace(System.out);
  }
}

JavaScript

/**
 * Load the API and make an API call.  Display the results on the screen.
 */
function callScriptFunction() {
  const scriptId = '<ENTER_YOUR_SCRIPT_ID_HERE>';

  // Call the Apps Script API run method
  //   'scriptId' is the URL parameter that states what script to run
  //   'resource' describes the run request body (with the function name
  //              to execute)
  try {
    gapi.client.script.scripts.run({
      'scriptId': scriptId,
      'resource': {
        'function': 'getFoldersUnderRoot',
      },
    }).then(function(resp) {
      const result = resp.result;
      if (result.error && result.error.status) {
        // The API encountered a problem before the script
        // started executing.
        appendPre('Error calling API:');
        appendPre(JSON.stringify(result, null, 2));
      } else if (result.error) {
        // The API executed, but the script returned an error.

        // Extract the first (and only) set of error details.
        // The values of this object are the script's 'errorMessage' and
        // 'errorType', and an array of stack trace elements.
        const error = result.error.details[0];
        appendPre('Script error message: ' + error.errorMessage);

        if (error.scriptStackTraceElements) {
          // There may not be a stacktrace if the script didn't start
          // executing.
          appendPre('Script error stacktrace:');
          for (let i = 0; i < error.scriptStackTraceElements.length; i++) {
            const trace = error.scriptStackTraceElements[i];
            appendPre('\t' + trace.function + ':' + trace.lineNumber);
          }
        }
      } else {
        // The structure of the result will depend upon what the Apps
        // Script function returns. Here, the function returns an Apps
        // Script Object with String keys and values, and so the result
        // is treated as a JavaScript object (folderSet).

        const folderSet = result.response.result;
        if (Object.keys(folderSet).length == 0) {
          appendPre('No folders returned!');
        } else {
          appendPre('Folders under your root folder:');
          Object.keys(folderSet).forEach(function(id) {
            appendPre('\t' + folderSet[id] + ' (' + id + ')');
          });
        }
      }
    });
  } catch (err) {
    document.getElementById('content').innerText = err.message;
    return;
  }
}

Node.js

/**
 * Call an Apps Script function to list the folders in the user's root Drive
 * folder.
 *
 */
async function callAppsScript() {
  const scriptId = '1xGOh6wCm7hlIVSVPKm0y_dL-YqetspS5DEVmMzaxd_6AAvI-_u8DSgBT';

  const {GoogleAuth} = require('google-auth-library');
  const {google} = require('googleapis');

  // Get credentials and build service
  // TODO (developer) - Use appropriate auth mechanism for your app
  const auth = new GoogleAuth({
    scopes: 'https://www.googleapis.com/auth/drive',
  });
  const script = google.script({version: 'v1', auth});

  try {
    // Make the API request. The request object is included here as 'resource'.
    const resp = await script.scripts.run({
      auth: auth,
      resource: {
        function: 'getFoldersUnderRoot',
      },
      scriptId: scriptId,
    });
    if (resp.error) {
      // The API executed, but the script returned an error.

      // Extract the first (and only) set of error details. The values of this
      // object are the script's 'errorMessage' and 'errorType', and an array
      // of stack trace elements.
      const error = resp.error.details[0];
      console.log('Script error message: ' + error.errorMessage);
      console.log('Script error stacktrace:');

      if (error.scriptStackTraceElements) {
        // There may not be a stacktrace if the script didn't start executing.
        for (let i = 0; i < error.scriptStackTraceElements.length; i++) {
          const trace = error.scriptStackTraceElements[i];
          console.log('\t%s: %s', trace.function, trace.lineNumber);
        }
      }
    } else {
      // The structure of the result will depend upon what the Apps Script
      // function returns. Here, the function returns an Apps Script Object
      // with String keys and values, and so the result is treated as a
      // Node.js object (folderSet).
      const folderSet = resp.response.result;
      if (Object.keys(folderSet).length == 0) {
        console.log('No folders returned!');
      } else {
        console.log('Folders under your root folder:');
        Object.keys(folderSet).forEach(function(id) {
          console.log('\t%s (%s)', folderSet[id], id);
        });
      }
    }
  } catch (err) {
    // TODO(developer) - Handle error
    throw err;
  }
}

Python

import google.auth
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError


def main():
  """Runs the sample."""
  # pylint: disable=maybe-no-member
  script_id = "1VFBDoJFy6yb9z7-luOwRv3fCmeNOzILPnR4QVmR0bGJ7gQ3QMPpCW-yt"

  creds, _ = google.auth.default()
  service = build("script", "v1", credentials=creds)

  # Create an execution request object.
  request = {"function": "getFoldersUnderRoot"}

  try:
    # Make the API request.
    response = service.scripts().run(scriptId=script_id, body=request).execute()
    if "error" in response:
      # The API executed, but the script returned an error.
      # Extract the first (and only) set of error details. The values of
      # this object are the script's 'errorMessage' and 'errorType', and
      # a list of stack trace elements.
      error = response["error"]["details"][0]
      print(f"Script error message: {0}.{format(error['errorMessage'])}")

      if "scriptStackTraceElements" in error:
        # There may not be a stacktrace if the script didn't start
        # executing.
        print("Script error stacktrace:")
        for trace in error["scriptStackTraceElements"]:
          print(f"\t{0}: {1}.{format(trace['function'], trace['lineNumber'])}")
    else:
      # The structure of the result depends upon what the Apps Script
      # function returns. Here, the function returns an Apps Script
      # Object with String keys and values, and so the result is
      # treated as a Python dictionary (folder_set).
      folder_set = response["response"].get("result", {})
      if not folder_set:
        print("No folders returned!")
      else:
        print("Folders under your root folder:")
        for folder_id, folder in folder_set.items():
          print(f"\t{0} ({1}).{format(folder, folder_id)}")

  except HttpError as error:
    # The API encountered a problem before the script started executing.
    print(f"An error occurred: {error}")
    print(error.content)


if __name__ == "__main__":
  main()

सीमाएं

Apps Script API की कई सीमाएं हैं:

  1. एक सामान्य Cloud प्रोजेक्ट. जिस स्क्रिप्ट को कॉल किया जा रहा है और कॉलिंग ऐप्लिकेशन को एक Cloud प्रोजेक्ट शेयर करना होगा. Cloud प्रोजेक्ट, स्टैंडर्ड Cloud प्रोजेक्ट होना चाहिए; Apps Script प्रोजेक्ट के लिए बनाए गए डिफ़ॉल्ट प्रोजेक्ट काफ़ी नहीं हैं. स्टैंडर्ड क्लाउड प्रोजेक्ट, नया या मौजूदा प्रोजेक्ट हो सकता है.

  2. बेसिक पैरामीटर और रिटर्न टाइप. एपीआई, Apps Script के लिए बने ऑब्जेक्ट (जैसे कि दस्तावेज़, ब्लॉब, कैलेंडर, Drive फ़ाइलें वगैरह) को पास नहीं कर सकता या उन्हें लौटा नहीं सकता. सिर्फ़ बेसिक टाइप, जैसे कि स्ट्रिंग, अरे, ऑब्जेक्ट, संख्याएं, और बूलियन को पास और लौटाया जा सकता है.

  3. OAuth के दायरे. API सिर्फ़ उन स्क्रिप्ट को एक्ज़ीक्यूट कर सकता है जिनमें कम से कम एक ज़रूरी स्कोप मौजूद हो. इसका मतलब यह है कि आप किसी ऐसी स्क्रिप्ट को कॉल करने के लिए एपीआई का इस्तेमाल नहीं कर सकते जिसमें एक या ज़्यादा सेवाओं के लिए अनुमति लेने की ज़रूरत न हो.

  4. कोई ट्रिगर नहीं.एपीआई, Apps Script ट्रिगर नहीं बना सकता.