Jump to content

Google Apps Script: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
 
(43 intermediate revisions by 30 users not shown)
Line 1: Line 1:
{{short description|Scripting platform developed by Google}}
{{short description|Scripting platform developed by Google}}
{{multiple|
{{Cleanup|date=February 2015|reason=uses lists instead of paragraphs}}
{{Advert|date=February 2018}}
}}
{{Infobox software
{{Infobox software
| name = Apps Script
| name = Apps Script
| logo = Google Apps Script.png
| collapsible = yes
| logo = Google Apps Script.svg
| logo caption =
| logo caption =
| screenshot = Google Apps Script workspace screenshot.png
| developer = [[Google]]
| developer = [[Google]]
| released = {{Start date and age|2009|8|19}}<ref>{{cite news|last=Meyer|first=David|title=Google Apps Script gets green light|url=http://news.cnet.com/8301-1001_3-10314002-92.html|access-date=26 March 2011|newspaper=CNet|date=August 20, 2009}}</ref>
| released = {{Start date and age|2009|8|19}}<ref>{{cite news|last=Meyer|first=David|title=Google Apps Script gets green light|url=http://news.cnet.com/8301-1001_3-10314002-92.html|access-date=26 March 2011|newspaper=CNet|date=August 20, 2009}}</ref>
| programming language = [[JavaScript]]
| programming language = [[JavaScript]]
| genre = [[Web application framework]], [[scripting framework]]
| genre = [[Web application framework]], scripting framework
| website = {{URL|https://script.google.com}}
| website = {{URL|https://script.google.com}}
}}
}}
'''Apps Script''' is a [[Scripting language|scripting]] platform developed by [[Google]] for light-weight application development in the [[Google Workspace]] platform. Google Apps Script was initially developed by Mike Harm as a side project while working as a developer on Google Sheets.<ref>{{cite web |last=Koleda|first=Eric |title=Celebrating 10 years of Apps Script: looking back on how it started |url=https://cloud.google.com/blog/products/g-suite/celebrating-10-years-of-apps-script-looking-back-on-how-it-started |website=Google Cloud Blog |access-date=22 August 2019 |date=August 21, 2019}}</ref> Google Apps Script was first publicly announced in May 2009 when a beta testing program was announced by Jonathan Rochelle, then Product Manager, Google Docs.<ref>{{cite web |last=Rochelle|first=Jonathan |title=Old tool, new tricks |url=https://cloud.googleblog.com/2009/05/old-tool-new-tricks.html |website=Google Cloud Blog |access-date=22 August 2019 |date=May 27, 2009}}</ref> In August 2009 Google Apps Script was subsequently made available to all Google Apps Premier and Education Edition customers.<ref>{{cite web |last=Levey|first=Evin |title=Google Apps Script Launched to Google Apps Premier and Education | url=http://googleappsscript.blogspot.com/2009/08/google-apps-script-launched-to-google.html |website=Google Apps Script |access-date=22 August 2019 |date=August 19, 2009}}</ref> It is based on [[JavaScript]] 1.6, but also includes some portions of 1.7 and 1.8 and a subset of the [[ECMAScript]] 5 API.<ref>{{cite journal|last=Kienle|first=Holger|title=It's About Time to Take JavaScript (More) Seriously|journal=IEEE Software|date=May–June 2010|volume=27|issue=3|pages=60–62|url=http://www.computer.org/portal/web/csdl/doi/10.1109/MS.2010.76|access-date=25 March 2011|doi=10.1109/MS.2010.76|archive-url=https://web.archive.org/web/20100629042409/http://www.computer.org/portal/web/csdl/doi/10.1109/MS.2010.76|archive-date=29 June 2010|url-status=dead}}</ref> Apps Script projects run [[server-side]] on [[Google]]'s infrastructure. According to Google, Apps Script "provides easy ways to automate tasks across Google products and third party services."<ref>[https://developers.google.com/apps-script/guides/services/#basic_javascript_features Google Apps Script]</ref> Apps Script is also the tool that powers the add-ons for [[Google Docs, Sheets and Slides]].<ref>[http://googledrive.blogspot.com/2014/03/add-ons.html Bring a little something extra to Docs and Sheets with add-ons]</ref>
'''Google Apps Script''' is a [[Scripting language|scripting]] platform developed by [[Google]] for light-weight application development in the [[Google Workspace]] platform. Google Apps Script was initially developed by Mike Harm as a side project while working as a developer on [[Google Sheets]].<ref>{{cite web |last=Koleda|first=Eric |title=Celebrating 10 years of Apps Script: looking back on how it started |url=https://cloud.google.com/blog/products/g-suite/celebrating-10-years-of-apps-script-looking-back-on-how-it-started |website=Google Cloud Blog |access-date=22 August 2019 |date=August 21, 2019}}</ref>


The primary function of Google Apps Script is to facilitate the creation of custom tools for organizations, primarily focusing on automating tasks and simplifying system administration processes. It supports a community-based model for user support.
==Benefits==
# Based on JavaScript 1.6 and a selection of JavaScript 1.7 and 1.8<ref>{{cite web |author1=Google Inc. |title=Built-in Google Services |url=https://developers.google.com/apps-script/guides/services/ |website=Google Apps Script |access-date=16 May 2019 |date=August 28, 2018}}</ref>
# Cloud based debugger for debugging App Scripts in the web browser.
# It can be used to create simple tools for an organization's internal consumption.
# It can be used to perform simple system administration tasks.
# Community-based support model. [https://stackoverflow.com/questions/tagged/google-apps-script]


Google Apps Script was first publicly announced in May 2009 when a beta testing program was announced by Jonathan Rochelle, then Product Manager for [[Google Docs]].<ref>{{cite web |last=Rochelle|first=Jonathan |title=Old tool, new tricks |url=https://cloud.googleblog.com/2009/05/old-tool-new-tricks.html |website=Google Cloud Blog |access-date=22 August 2019 |date=May 27, 2009}}</ref> In August 2009, Google Apps Script was subsequently made available to all Google Apps Premier and Education Edition customers.<ref>{{cite web |last=Levey|first=Evin |title=Google Apps Script Launched to Google Apps Premier and Education | url=http://googleappsscript.blogspot.com/2009/08/google-apps-script-launched-to-google.html |website=Google Apps Script |access-date=22 August 2019 |date=August 19, 2009}}</ref>
==Limitations==
# Processing limitations{{snd}} As a cloud-based service, Apps Script limits the time that a user's script may run, as well as limiting access to Google services.<ref>https://developers.google.com/apps-script/guides/services/quotas</ref>
# Currently Google Apps Store does not allow direct connection to internal (behind-the-firewall) corporate databases, which is key to building business apps, however, via use of the JDBC service, this can be overcome, if connections are allowed from Google servers to the internal database server.<ref>https://developers.google.com/apps-script/guides/jdbc</ref> Similarly, lack of other connectivity, such as LDAP connectivity, limits the level to which GAS can be used in the enterprise.{{Citation needed|date=November 2012}}
# Due to the cloud nature of Apps Script, functions related to date and time will produce results that seem to be incorrect due to the data crossing [[time zone]]s. Using Date/Time objects and functions without very precise declaration and thorough testing may result in inaccurate results.<ref>{{cite web|title=Issue 1035: utilities.formatdate subtracts a day. | url=https://code.google.com/p/google-apps-script-issues/issues/detail?id=1035|access-date=17 December 2012}}</ref>


==Technical details==
==Example==
Until 2020, Google Apps Script was based on [[Mozilla]]'s Rhino [[JavaScript]] (JS) interpreter, which limited its JS language support to version 1.6, with a subset of the [[ECMAScript]] 5 API.<ref>{{cite journal|last=Kienle|first=Holger|title=It's About Time to Take JavaScript (More) Seriously|journal=IEEE Software|date=May–June 2010|volume=27|issue=3|pages=60–62|url=http://www.computer.org/portal/web/csdl/doi/10.1109/MS.2010.76|access-date=25 March 2011|doi=10.1109/MS.2010.76|s2cid=11650861|archive-url=https://web.archive.org/web/20100629042409/http://www.computer.org/portal/web/csdl/doi/10.1109/MS.2010.76|archive-date=29 June 2010|url-status=dead}}</ref> In March 2020, Google announced the introduction of the [[V8 (JavaScript engine)|V8 JS runtime]], bringing with it full support of modern [[ECMAScript]] except for JS modules.<ref>{{cite web | url=https://workspace.google.com/blog/developers-practitioners/data-processing-just-got-easier-apps-scripts-new-v8-runtime | title=Apps Script's new V8 runtime }}</ref>
<syntaxhighlight lang="javascript>
function doGet(e) {
var searchTerm = 'Script Tools'
var ui = XmlService.createDocument(XmlService.createElement('html')).setDocType(XmlService.createDocType('html'))
var body = XmlService.createElement('body')
body = buildTree(body, searchTerm);
ui.getRootElement().addContent(body)
return HtmlService.createHtmlOutput(XmlService.getRawFormat().format(ui))
}


The development environment for Google Apps Script is hosted in the cloud, with an [[Integrated development environment|IDE]] with a [[debugger]] for developing scripts directly within a web browser.The infrastructure provided by Google serves as the execution environment for Apps Script projects. This platform enables the automation of tasks across Google services and integration with third-party applications.<ref>[https://developers.google.com/apps-script/guides/services/#basic_javascript_features Google Apps Script]</ref> Additionally, Google Apps Script facilitates the development of add-ons for Google Docs, Sheets, and Slides, enhancing their functionality.<ref>[http://googledrive.blogspot.com/2014/03/add-ons.html Bring a little something extra to Docs and Sheets with add-ons]</ref>


==Limitations==
function buildTree(node, searchTerm) {
{{Jargon|date=March 2024|section}}
var ul = XmlService.createElement('ul').addContent(XmlService.createElement('p').addContent(XmlService.createText(searchTerm)));
Google Apps Script has some processing limitations. As a cloud-based service, Apps Script limits the time that a user's script may run, as well as limiting access to Google services.<ref>{{Cite web |title=Quotas for Google Services &#124; Apps Script |url=https://developers.google.com/apps-script/guides/services/quotas}}</ref> Currently, the Google Apps Store does not allow direct connections to internal (behind-the-firewall) corporate databases, which is key to building business apps. However, this can be overcome via the use of the JDBC service if connections are allowed from Google servers to the internal database server.<ref>{{Cite web |title=JDBC &#124; Apps Script |url=https://developers.google.com/apps-script/guides/jdbc}}</ref> Similarly, lack of other connectivity, such as LDAP connectivity, limits the level to which GAS can be used in the enterprise.{{Citation needed|date=November 2012}} Due to the cloud nature of Apps Script, functions related to date and time will produce results that seem to be incorrect due to the data crossing [[time zone]]s. Using Date/Time objects and functions without very precise declaration and thorough testing may result in inaccurate results.<ref>{{cite web |title=Issue 1035: utilities.formatdate subtracts a day. |url=https://code.google.com/p/google-apps-script-issues/issues/detail?id=1035 |access-date=17 December 2012}}</ref>
// Use of the Apps Script DriveApp Service to retrieve the collections.
var folders = DriveApp.getFoldersByName(searchTerm).next().getFolders()
while (folders.hasNext()){
var thisFolder = folders.next();
var li = XmlService.createElement('li');
var resp = buildTree(li, thisFolder.getName())
ul.addContent(li);
}

var files = DriveApp.getFoldersByName(searchTerm).next().getFiles()
while (files.hasNext()) {
var thisFile = files.next()
if (thisFile.getMimeType() === "application/vnd.google-apps.document") {
urlBase = "https://docs.google.com/document/edit?id=";
iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.document";
}
else if (thisFile.getMimeType() === "application/vnd.google-apps.spreadsheet") {
urlBase = "https://spreadsheets.google.com/ccc?key=";
iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.spreadsheet";
}
else if (thisFile.getMimeType() === "application/vnd.google-apps.script") {
urlBase = "https://docs.google.com/fileview?id=";
iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.script";
}
else if (thisFile.getMimeType() === "application/vnd.google-apps.presentation") {
urlBase = "https://docs.google.com/present/edit?id=";
iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.presentation";
}
else if (thisFile.getMimeType() === "application/vnd.google-apps.drawing") {
urlBase = "https://docs.google.com/drawings/edit?id=";
iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.drawing";
}
else {
urlBase = "https://docs.google.com/fileview?id=";
iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/application/vnd.google-apps.unknown";
}
var li = XmlService.createElement('li');
var image = XmlService.createElement('img').setAttribute('src', iconHTML);
var fileLabel = XmlService.createElement('a').setAttribute('href', urlBase + thisFile.getId())
.setAttribute('target', '_blank').addContent(XmlService.createText(thisFile.getName()))
var fileLabelPanel = XmlService.createElement('div').setAttribute('style', 'display:flex;flex-direction: row;')
fileLabelPanel.addContent(image)
fileLabelPanel.addContent(fileLabel)
li.addContent(fileLabelPanel)
ul.addContent(li)
}
node.addContent(ul)
return node;
}
</syntaxhighlight>


==Add-ons==
==Add-ons==
In March 2014, Google introduced add-ons for Docs and Sheets (soon followed by Forms). The add-on stores let users add extra features to Google editors, such as mail-merging, workflows, diagrams builders,... All add-ons are either 100% built with Apps Script or simply use Apps Script to display a UI in the Google editors while relying on an external backend to perform some tasks. For example, MailChimp, a mail-merging tool, has an add-on for Google Docs that communicates with MailChimp platform to send emails.
In March 2014, Google introduced add-ons for [[Google Docs|Docs]] and [[Google Sheets|Sheets]] (soon followed by Forms). The add-on stores let users add extra features to Google editors, such as mail-merging, workflows, and diagram builders. All add-ons are either 100% built with Apps Script or simply use Apps Script to display a UI in the Google editors while relying on an external back-end to perform some tasks. For example, MailChimp, a mail-merging tool, has an add-on for Google Docs that communicates with MailChimp platform to send emails.


Before add-ons, it was possible to publish scripts for Google Sheets in the Script Gallery. When users installed scripts through this gallery, a copy of the Apps Script code was installed on the user's Sheet. With add-ons, the source code is not visible to the end user and everyone is using the latest version published by the developer. This new approach makes it easier to support existing code and helped convince several companies, such as MailChimp or LucidChart to invest in Apps Script.
Before add-ons, it was possible to publish scripts for Google Sheets in the Script Gallery. When users installed scripts through this gallery, a copy of the Apps Script code was installed on the user's Sheet. With add-ons, the source code is not visible to the end user, and everyone is using the latest version published by the developer. This new approach makes it easier to support existing code and helped convince several companies, such as [[Mailchimp|MailChimp]] or [[Lucidchart]] to invest in Apps Script.


As part of the add-ons release, Google also introduced a UI Style Guide<ref>[https://developers.google.com/apps-script/add-ons/style UI Style Guide for Add-ons]</ref> and CSS package to help developers built add-ons that integrate smoothly into the editors. Each add-on is also reviewed by Google before its publication and developers can benefit from advice from Googlers to provide a better user experience. It is not possible to embed ads in add-ons but it is possible to monetize them.<ref>[https://sites.google.com/site/scriptsexamples/home/announcements/ivestartedalittleexperiment I've started a little experiment...]</ref>
As part of the add-ons release, Google also introduced a UI Style Guide<ref>[https://developers.google.com/apps-script/add-ons/style UI Style Guide for Add-ons]</ref> and CSS package to help developers build add-ons that integrate into the editors. Each add-on is also reviewed by Google before its publication, and developers can benefit from advice from Googlers to provide a better user experience. It is not possible to embed ads in add-ons but it is possible to monetize them.<ref>{{Cite web |url=https://sites.google.com/site/scriptsexamples/home/announcements/ivestartedalittleexperiment |title=I've started a little experiment... |access-date=2014-11-18 |archive-date=2017-02-26 |archive-url=https://web.archive.org/web/20170226055451/https://sites.google.com/site/scriptsexamples/home/announcements/ivestartedalittleexperiment |url-status=dead }}</ref>


==See also==
==See also==
*[[Scripting language]]
*[[List of scripting languages]]
*[[List of scripting languages]]
*[[Google App Engine]]
*[[Google App Maker]]


==References==
==References==
Line 123: Line 53:
[[Category:Scripting languages]]
[[Category:Scripting languages]]
[[Category:Web frameworks]]
[[Category:Web frameworks]]
[[Category:Computer-related introductions in 2009]]
[[Category:Internet properties established in 2009]]

Latest revision as of 13:03, 9 May 2024

Apps Script
Developer(s)Google
Initial releaseAugust 19, 2009; 14 years ago (2009-08-19)[1]
Written inJavaScript
TypeWeb application framework, scripting framework
Websitescript.google.com

Google Apps Script is a scripting platform developed by Google for light-weight application development in the Google Workspace platform. Google Apps Script was initially developed by Mike Harm as a side project while working as a developer on Google Sheets.[2]

The primary function of Google Apps Script is to facilitate the creation of custom tools for organizations, primarily focusing on automating tasks and simplifying system administration processes. It supports a community-based model for user support.

Google Apps Script was first publicly announced in May 2009 when a beta testing program was announced by Jonathan Rochelle, then Product Manager for Google Docs.[3] In August 2009, Google Apps Script was subsequently made available to all Google Apps Premier and Education Edition customers.[4]

Technical details[edit]

Until 2020, Google Apps Script was based on Mozilla's Rhino JavaScript (JS) interpreter, which limited its JS language support to version 1.6, with a subset of the ECMAScript 5 API.[5] In March 2020, Google announced the introduction of the V8 JS runtime, bringing with it full support of modern ECMAScript except for JS modules.[6]

The development environment for Google Apps Script is hosted in the cloud, with an IDE with a debugger for developing scripts directly within a web browser.The infrastructure provided by Google serves as the execution environment for Apps Script projects. This platform enables the automation of tasks across Google services and integration with third-party applications.[7] Additionally, Google Apps Script facilitates the development of add-ons for Google Docs, Sheets, and Slides, enhancing their functionality.[8]

Limitations[edit]

Google Apps Script has some processing limitations. As a cloud-based service, Apps Script limits the time that a user's script may run, as well as limiting access to Google services.[9] Currently, the Google Apps Store does not allow direct connections to internal (behind-the-firewall) corporate databases, which is key to building business apps. However, this can be overcome via the use of the JDBC service if connections are allowed from Google servers to the internal database server.[10] Similarly, lack of other connectivity, such as LDAP connectivity, limits the level to which GAS can be used in the enterprise.[citation needed] Due to the cloud nature of Apps Script, functions related to date and time will produce results that seem to be incorrect due to the data crossing time zones. Using Date/Time objects and functions without very precise declaration and thorough testing may result in inaccurate results.[11]

Add-ons[edit]

In March 2014, Google introduced add-ons for Docs and Sheets (soon followed by Forms). The add-on stores let users add extra features to Google editors, such as mail-merging, workflows, and diagram builders. All add-ons are either 100% built with Apps Script or simply use Apps Script to display a UI in the Google editors while relying on an external back-end to perform some tasks. For example, MailChimp, a mail-merging tool, has an add-on for Google Docs that communicates with MailChimp platform to send emails.

Before add-ons, it was possible to publish scripts for Google Sheets in the Script Gallery. When users installed scripts through this gallery, a copy of the Apps Script code was installed on the user's Sheet. With add-ons, the source code is not visible to the end user, and everyone is using the latest version published by the developer. This new approach makes it easier to support existing code and helped convince several companies, such as MailChimp or Lucidchart to invest in Apps Script.

As part of the add-ons release, Google also introduced a UI Style Guide[12] and CSS package to help developers build add-ons that integrate into the editors. Each add-on is also reviewed by Google before its publication, and developers can benefit from advice from Googlers to provide a better user experience. It is not possible to embed ads in add-ons but it is possible to monetize them.[13]

See also[edit]

References[edit]

  1. ^ Meyer, David (August 20, 2009). "Google Apps Script gets green light". CNet. Retrieved 26 March 2011.
  2. ^ Koleda, Eric (August 21, 2019). "Celebrating 10 years of Apps Script: looking back on how it started". Google Cloud Blog. Retrieved 22 August 2019.
  3. ^ Rochelle, Jonathan (May 27, 2009). "Old tool, new tricks". Google Cloud Blog. Retrieved 22 August 2019.
  4. ^ Levey, Evin (August 19, 2009). "Google Apps Script Launched to Google Apps Premier and Education". Google Apps Script. Retrieved 22 August 2019.
  5. ^ Kienle, Holger (May–June 2010). "It's About Time to Take JavaScript (More) Seriously". IEEE Software. 27 (3): 60–62. doi:10.1109/MS.2010.76. S2CID 11650861. Archived from the original on 29 June 2010. Retrieved 25 March 2011.
  6. ^ "Apps Script's new V8 runtime".
  7. ^ Google Apps Script
  8. ^ Bring a little something extra to Docs and Sheets with add-ons
  9. ^ "Quotas for Google Services | Apps Script".
  10. ^ "JDBC | Apps Script".
  11. ^ "Issue 1035: utilities.formatdate subtracts a day". Retrieved 17 December 2012.
  12. ^ UI Style Guide for Add-ons
  13. ^ "I've started a little experiment..." Archived from the original on 2017-02-26. Retrieved 2014-11-18.

External links[edit]