অ্যাপস স্ক্রিপ্ট এপিআই-তে একটি scripts.run মেথড রয়েছে, যা দূরবর্তীভাবে একটি নির্দিষ্ট গুগল অ্যাপস স্ক্রিপ্ট ফাংশন কার্যকর করে। আপনি একটি কলিং অ্যাপ্লিকেশনে এই মেথডটি ব্যবহার করে আপনার স্ক্রিপ্ট প্রজেক্টগুলোর কোনো একটির ফাংশন দূরবর্তীভাবে রান করতে এবং একটি রেসপন্স পেতে পারেন।
প্রয়োজনীয়তা
কোনো কলিং অ্যাপ্লিকেশন scripts.run মেথডটি ব্যবহার করার আগে, আপনাকে অবশ্যই:
স্ক্রিপ্ট প্রজেক্টটিকে একটি এপিআই এক্সিকিউটেবল হিসেবে ডেপ্লয় করুন। আপনি প্রয়োজন অনুযায়ী প্রজেক্ট ডেপ্লয়, আনডেপ্লয় এবং রিডেপ্লয় করতে পারেন।
এক্সিকিউশনের জন্য একটি যথাযথ স্কোপযুক্ত OAuth টোকেন প্রদান করুন। এই OAuth টোকেনটিকে অবশ্যই স্ক্রিপ্ট দ্বারা ব্যবহৃত সমস্ত স্কোপ অন্তর্ভুক্ত করতে হবে, শুধু কল করা ফাংশন দ্বারা ব্যবহৃত স্কোপগুলো নয়। মেথড রেফারেন্সে অথরাইজেশন স্কোপগুলোর সম্পূর্ণ তালিকা দেখুন।
নিশ্চিত করুন যে স্ক্রিপ্ট এবং কলিং অ্যাপ্লিকেশনের OAuth2 ক্লায়েন্ট একটি সাধারণ গুগল ক্লাউড প্রজেক্ট ব্যবহার করছে। ক্লাউড প্রজেক্টটি অবশ্যই একটি স্ট্যান্ডার্ড ক্লাউড প্রজেক্ট হতে হবে; অ্যাপস স্ক্রিপ্ট প্রজেক্টের জন্য তৈরি ডিফল্ট প্রজেক্টগুলো যথেষ্ট নয়। আপনি একটি নতুন স্ট্যান্ডার্ড ক্লাউড প্রজেক্ট অথবা একটি বিদ্যমান প্রজেক্ট ব্যবহার করতে পারেন।
ক্লাউড প্রজেক্টে গুগল অ্যাপস স্ক্রিপ্ট এপিআই সক্রিয় করুন ।
scripts.run পদ্ধতি
scripts.run মেথডটির জন্য নিম্নলিখিত তথ্য প্রয়োজন:
- কার্যকর করার জন্য স্ক্রিপ্ট ডিপ্লয়মেন্টের ডিপ্লয়মেন্ট আইডি ।
- যে ফাংশনটি সম্পাদন করতে হবে তার নাম ।
- ফাংশনটির জন্য প্রয়োজনীয় প্যারামিটারগুলোর তালিকা , যদি থাকে।
আপনি চাইলে আপনার স্ক্রিপ্টটিকে ডেভেলপমেন্ট মোডে চালানোর জন্য কনফিগার করতে পারেন। এই মোডটি স্ক্রিপ্ট প্রজেক্টের সর্বশেষ ডেপ্লয় করা ভার্সনের পরিবর্তে সর্বশেষ সেভ করা ভার্সন দিয়ে চলে। এটি করার জন্য, রিকোয়েস্ট বডিতে থাকা devMode বুলিয়ানটিকে true তে সেট করুন। শুধুমাত্র স্ক্রিপ্টটির মালিকই এটিকে ডেভেলপমেন্ট মোডে চালাতে পারবেন।
প্যারামিটার ডেটা টাইপগুলি পরিচালনা করুন
অ্যাপস স্ক্রিপ্ট এপিআই-এর scripts.run মেথড ব্যবহার করে সাধারণত ফাংশন প্যারামিটার হিসেবে অ্যাপস স্ক্রিপ্টে ডেটা পাঠানো হয় এবং ফাংশনের রিটার্ন ভ্যালু হিসেবে তা ফেরত পাওয়া যায়। এই এপিআই শুধুমাত্র বেসিক টাইপের ভ্যালু গ্রহণ ও ফেরত দিতে পারে: যেমন স্ট্রিং, অ্যারে, অবজেক্ট, নাম্বার এবং বুলিয়ান। ডকুমেন্ট বা শীটের মতো আরও জটিল অ্যাপস স্ক্রিপ্ট অবজেক্টগুলো এই এপিআই-এর মাধ্যমে স্ক্রিপ্ট প্রজেক্টে পাঠানো বা প্রজেক্ট থেকে গ্রহণ করা যায় না।
যখন আপনার কলিং অ্যাপ্লিকেশনটি জাভার মতো কোনো স্ট্রংলি টাইপড ল্যাঙ্গুয়েজে লেখা হয়, তখন এটি এই বেসিক টাইপগুলোর সাথে সঙ্গতিপূর্ণ জেনেরিক অবজেক্টের একটি লিস্ট বা অ্যারে হিসেবে প্যারামিটার পাস করে। অনেক ক্ষেত্রে, আপনি স্বয়ংক্রিয়ভাবে টাইপ কনভার্সন প্রয়োগ করতে পারেন। উদাহরণস্বরূপ, যে ফাংশনটি একটি নাম্বার প্যারামিটার গ্রহণ করে, তাকে কোনো অতিরিক্ত ব্যবস্থা ছাড়াই প্যারামিটার হিসেবে একটি জাভা Double (Double), Integer ), বা Long অবজেক্ট দেওয়া যেতে পারে।
যখন এপিআই ফাংশন রেসপন্স ফেরত দেয়, তখন ব্যবহারের আগে প্রায়শই ফেরত আসা ভ্যালুটিকে সঠিক টাইপে কাস্ট করার প্রয়োজন হয়। এখানে জাভা-ভিত্তিক কিছু উদাহরণ দেওয়া হলো:
- এপিআই থেকে জাভা অ্যাপ্লিকেশনে ফেরত আসা সংখ্যাগুলো
java.math.BigDecimalঅবজেক্ট হিসেবে আসে এবং সেগুলোকেDoubleবাintটাইপে রূপান্তর করার প্রয়োজন হতে পারে। যদি অ্যাপস স্ক্রিপ্ট ফাংশনটি স্ট্রিং-এর একটি অ্যারে রিটার্ন করে, তাহলে একটি জাভা অ্যাপ্লিকেশন সেই রেসপন্সটিকে একটি
List<String>অবজেক্টে কাস্ট করে:List<String> mylist = (List<String>)(op.getResponse().get("result"));যদি আপনি
Bytesএর একটি অ্যারে ফেরত দিতে চান, তাহলে অ্যাপস স্ক্রিপ্ট ফাংশনের মধ্যে অ্যারেটিকে একটি বেস৬৪ স্ট্রিং হিসাবে এনকোড করুন এবং তার পরিবর্তে সেই স্ট্রিংটি ফেরত দিন:return Utilities.base64Encode(myByteArray); // returns a string.
নিচের উদাহরণ কোড নমুনাগুলো এপিআই প্রতিক্রিয়া ব্যাখ্যা করার বিভিন্ন উপায় তুলে ধরে।
সাধারণ পদ্ধতি
অ্যাপস স্ক্রিপ্ট এপিআই ব্যবহার করে অ্যাপস স্ক্রিপ্ট ফাংশনগুলো কার্যকর করতে, এই ধাপগুলো অনুসরণ করুন:
ধাপ ১: সাধারণ ক্লাউড প্রজেক্টটি সেট আপ করুন।
আপনার স্ক্রিপ্ট এবং কলিং অ্যাপ্লিকেশন উভয়কেই একই ক্লাউড প্রজেক্ট ব্যবহার করতে হবে। এই ক্লাউড প্রজেক্টটি একটি বিদ্যমান প্রজেক্ট হতে পারে অথবা এই উদ্দেশ্যে তৈরি করা একটি নতুন প্রজেক্টও হতে পারে। একবার আপনার একটি ক্লাউড প্রজেক্ট তৈরি হয়ে গেলে, সেটি ব্যবহার করার জন্য আপনাকে অবশ্যই আপনার স্ক্রিপ্ট প্রজেক্টটি পরিবর্তন করতে হবে।
ধাপ ২: স্ক্রিপ্টটিকে একটি API এক্সিকিউটেবল হিসেবে স্থাপন করুন।
- আপনার ব্যবহার করতে চাওয়া ফাংশনগুলোসহ অ্যাপস স্ক্রিপ্ট প্রজেক্টটি খুলুন।
- উপরের ডানদিকে, Deploy > New Deployment-এ ক্লিক করুন।
- যে ডায়ালগ বক্সটি খুলবে, সেখানে 'Enable deployment types'-এ ক্লিক করুন।
এপিআই এক্সিকিউটেবল ।
- "কার অ্যাক্সেস আছে" ড্রপ-ডাউন মেনু থেকে সেই ব্যবহারকারীদের নির্বাচন করুন, যারা অ্যাপস স্ক্রিপ্ট এপিআই (Apps Script API) ব্যবহার করে স্ক্রিপ্টের ফাংশনগুলো কল করার অনুমতি পাবেন।
- ডিপ্লয়-এ ক্লিক করুন।
ধাপ ৩: কলিং অ্যাপ্লিকেশনটি কনফিগার করুন।
ব্যবহারের পূর্বে কলিং অ্যাপ্লিকেশনটিকে অবশ্যই অ্যাপস স্ক্রিপ্ট এপিআই (Apps Script API) সক্রিয় করতে হবে এবং ওঅথ (OAuth) ক্রেডেনশিয়াল স্থাপন করতে হবে। এটি করার জন্য আপনার ক্লাউড প্রজেক্টে অ্যাক্সেস থাকতে হবে।
- আপনার কলিং অ্যাপ্লিকেশন এবং স্ক্রিপ্ট যে ক্লাউড প্রজেক্টটি ব্যবহার করছে, সেটি কনফিগার করুন:
- স্ক্রিপ্ট প্রজেক্টটি খুলুন এবং বাম দিকে, ওভারভিউ-তে ক্লিক করুন।
.
- প্রজেক্ট OAuth স্কোপস-এর অধীনে, স্ক্রিপ্টটির জন্য প্রয়োজনীয় সমস্ত স্কোপ রেকর্ড করুন।
কলিং অ্যাপ্লিকেশন কোডে, এপিআই কলের জন্য একটি স্ক্রিপ্ট OAuth অ্যাক্সেস টোকেন তৈরি করুন। এই টোকেনটি এপিআই নিজে ব্যবহার করে না, বরং এটি স্ক্রিপ্টটি চালানোর জন্য প্রয়োজন হয়। এটি ক্লাউড প্রজেক্ট ক্লায়েন্ট আইডি এবং আপনার রেকর্ড করা স্ক্রিপ্ট স্কোপগুলো ব্যবহার করে তৈরি করা উচিত।
গুগল ক্লায়েন্ট লাইব্রেরিগুলো এই টোকেন তৈরি করতে এবং অ্যাপ্লিকেশনের জন্য OAuth পরিচালনা করতে সহায়তা করতে পারে, যা সাধারণত আপনাকে স্ক্রিপ্ট স্কোপ ব্যবহার করে একটি উচ্চ-স্তরের "ক্রেডেনশিয়ালস" অবজেক্ট তৈরি করার সুযোগ দেয়। স্কোপের তালিকা থেকে ক্রেডেনশিয়ালস অবজেক্ট তৈরির উদাহরণের জন্য অ্যাপস স্ক্রিপ্ট এপিআই কুইকস্টার্টস দেখুন।
ধাপ ৪: scripts.run অনুরোধটি করুন।
কলিং অ্যাপ্লিকেশনটি কনফিগার করা হয়ে গেলে, আপনি scripts.run কল করতে পারবেন:
- ডিপ্লয়মেন্ট আইডি, ফাংশনের নাম এবং প্রয়োজনীয় প্যারামিটারগুলো ব্যবহার করে একটি এপিআই রিকোয়েস্ট তৈরি করুন।
-
scripts.runকলটি করুন এবং হেডারে আপনার তৈরি করা স্ক্রিপ্ট OAuth টোকেনটি অন্তর্ভুক্ত করুন (যদি একটি সাধারণPOSTঅনুরোধ ব্যবহার করেন) অথবা স্ক্রিপ্ট স্কোপ সহ আপনার তৈরি করা একটি credentials অবজেক্ট ব্যবহার করুন। - স্ক্রিপ্টটিকে তার নির্বাহ শেষ করতে দিন। স্ক্রিপ্ট নির্বাহ হতে ছয় মিনিট পর্যন্ত সময় লাগতে পারে, তাই আপনার অ্যাপ্লিকেশনে এই বিষয়টি বিবেচনা করা উচিত।
- কাজ শেষ হলে, স্ক্রিপ্ট ফাংশনটি একটি মান রিটার্ন করতে পারে, যা সমর্থিত ধরনের হলে এপিআই অ্যাপ্লিকেশনটিতে ফেরত পাঠায়।
পরবর্তী অংশে scripts.run API কলের উদাহরণ পাবেন।
আপনার অ্যাক্সেস টোকেন রিফ্রেশ করতে, আপনার scripts.run API অনুরোধের আগে নিম্নলিখিত কোডটি যোগ করুন:
if (credential.getExpiresInSeconds() <= 360) {
credential.refreshToken();
}
এপিআই অনুরোধের উদাহরণ
নিম্নলিখিত উদাহরণগুলিতে দেখানো হয়েছে কিভাবে বিভিন্ন ভাষায় একটি অ্যাপস স্ক্রিপ্ট এপিআই এক্সিকিউশন রিকোয়েস্ট করতে হয়, যেখানে ব্যবহারকারীর রুট ডিরেক্টরিতে থাকা ফোল্ডারগুলির একটি তালিকা প্রিন্ট করার জন্য একটি অ্যাপস স্ক্রিপ্ট ফাংশন কল করা হয়। যে অ্যাপস স্ক্রিপ্ট প্রজেক্টে এক্সিকিউটেড ফাংশনটি রয়েছে, তার ডিপ্লয়মেন্ট আইডি অবশ্যই ENTER_YOUR_DEPLOYMENT_ID_HERE দিয়ে নির্দেশিত স্থানে উল্লেখ করতে হবে। এই উদাহরণগুলি গুগল এপিআই ক্লায়েন্ট লাইব্রেরির উপর নির্ভরশীল।
লক্ষ্য স্ক্রিপ্ট
এই স্ক্রিপ্টের ফাংশনটি ড্রাইভ এপিআই (Drive API) ব্যবহার করে।
যে প্রজেক্টে স্ক্রিপ্টটি হোস্ট করা আছে, সেখানে আপনাকে অবশ্যই ড্রাইভ এপিআই (Drive API) সক্রিয় করতে হবে।
এছাড়াও, কলিং অ্যাপ্লিকেশনগুলিকে অবশ্যই OAuth ক্রেডেনশিয়াল পাঠাতে হবে, যার মধ্যে নিম্নলিখিত Drive স্কোপ অন্তর্ভুক্ত থাকবে:
-
https://www.googleapis.com/auth/drive
এখানের উদাহরণ অ্যাপ্লিকেশনগুলো এই স্কোপ ব্যবহার করে OAuth-এর জন্য ক্রেডেনশিয়াল অবজেক্ট তৈরি করতে গুগল ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
/**
* 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;
}
জাভা
/**
* 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);
}
}
জাভাস্ক্রিপ্ট
/**
* 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;
}
}
নোড.জেএস
import {GoogleAuth} from 'google-auth-library';
import {google} from 'googleapis';
/**
* Calls an Apps Script function to list the folders in the user's root Drive folder.
*/
async function callAppsScript() {
// The ID of the Apps Script project to call.
const scriptId = '1xGOh6wCm7hlIVSVPKm0y_dL-YqetspS5DEVmMzaxd_6AAvI-_u8DSgBT';
// Authenticate with Google and get an authorized client.
// TODO (developer): Use an appropriate auth mechanism for your app.
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
// Create a new Apps Script API client.
const script = google.script({version: 'v1', auth});
const resp = await script.scripts.run({
auth,
requestBody: {
// The name of the function to call in the Apps Script project.
function: 'getFoldersUnderRoot',
},
scriptId,
});
if (resp.data.error?.details?.[0]) {
// The API executed, but the script returned an error.
// Extract the error details.
const error = resp.data.error.details[0];
console.log(`Script error message: ${error.errorMessage}`);
console.log('Script error stacktrace:');
if (error.scriptStackTraceElements) {
// Log the stack trace.
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 script executed successfully.
// The structure of the response depends on the Apps Script function's return value.
const folderSet = resp.data.response ?? {};
if (Object.keys(folderSet).length === 0) {
console.log('No folders returned!');
} else {
console.log('Folders under your root folder:');
Object.keys(folderSet).forEach((id) => {
console.log('\t%s (%s)', folderSet[id], id);
});
}
}
}
পাইথন
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()
সীমাবদ্ধতা
অ্যাপস স্ক্রিপ্ট এপিআই-এর নিম্নলিখিত সীমাবদ্ধতাগুলো রয়েছে:
একটি সাধারণ ক্লাউড প্রজেক্ট । যে স্ক্রিপ্টটি কল করা হচ্ছে এবং যে অ্যাপ্লিকেশনটি কল করছে, উভয়েরই একটি ক্লাউড প্রজেক্ট থাকতে হবে। ক্লাউড প্রজেক্টটি অবশ্যই একটি স্ট্যান্ডার্ড ক্লাউড প্রজেক্ট হতে হবে; অ্যাপস স্ক্রিপ্ট প্রজেক্টের জন্য তৈরি ডিফল্ট প্রজেক্টগুলো যথেষ্ট নয়।
মৌলিক প্যারামিটার এবং রিটার্ন টাইপ । এপিআই অ্যাপ্লিকেশনটিতে অ্যাপস স্ক্রিপ্ট-নির্দিষ্ট অবজেক্ট (যেমন ডকুমেন্ট , ব্লব , ক্যালেন্ডার , ড্রাইভ ফাইল ইত্যাদি) পাস বা রিটার্ন করতে পারে না। শুধুমাত্র স্ট্রিং, অ্যারে, অবজেক্ট, সংখ্যা এবং বুলিয়ানের মতো মৌলিক টাইপগুলোই পাস এবং রিটার্ন করা যায়।
OAuth স্কোপ । API শুধুমাত্র সেই স্ক্রিপ্টগুলোই চালাতে পারে যেগুলোর অন্তত একটি প্রয়োজনীয় স্কোপ রয়েছে। এর মানে হলো, আপনি এমন কোনো স্ক্রিপ্ট কল করার জন্য API ব্যবহার করতে পারবেন না, যার জন্য এক বা একাধিক সার্ভিসের অনুমোদনের প্রয়োজন নেই।
কোনো ট্রিগার নেই । এপিআইটি অ্যাপস স্ক্রিপ্ট ট্রিগার তৈরি করতে পারে না।