php [appscript api] google app script api

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php [appscript api] google app script api相关的知识,希望对你有一定的参考价值。

<?php
/*
https://github.com/google/google-api-php-client/blob/master/README.md
https://github.com/gsuitedevs/php-samples/blob/master/apps-script/quickstart/quickstart.php
*/
$service = new Google_Service_Script($client);

// Create a management request object (update a script content).
$request = new Google_Service_Script_CreateProjectRequest();
$request->setTitle('My Script');
$response = $service->projects->create($request);
$scriptId = $response->getScriptId();
$file1 = new Google_Service_Script_ScriptFile();
$file1->setName('hello');
$file1->setType('SERVER_JS');
$file1->setSource("function helloWorld() {\n  console.log(\"Hello, world!\"" +
                  ");\n}");
$file2 = new Google_Service_Script_ScriptFile();
$file2->setName('appsscript');
$file2->setType('JSON');
$file2->setSource("{\"timeZone\":\"America/New_York\",\"exceptionLogging\"" +
                  ":\"CLOUD\"}");
$request = new Google_Service_Script_Content();
$request->setScriptId($scriptId);
$request->setFiles([$file1, $file2]);
$response = $service->projects->updateContent($scriptId, $request);
echo 'https://script.google.com/d/' . $response->getScriptId() . '/edit';

以上是关于php [appscript api] google app script api的主要内容,如果未能解决你的问题,请参考以下文章

尝试使用 appscripts 将多个文件上传到 Google Drive

如何使用 AppScript 在 BigQuery 中将 Google 工作表持久化为表格

某些Google幻灯片AppScript是否已记录但不受支持?

未返回Google Appscript VALUE

Google 表格/AppScript - 将数据从一张表格复制到另一张表格

使用Appscript将Google图表中的3d图表作为图像插入电子邮件中