background preloader

Building Your First Script - Google Apps Script

Building Your First Script - Google Apps Script
Google Apps Script is a rapid application development platform that makes it fast and easy to create business applications that integrate with Google Workspace. You write code in modern JavaScript and have access to built-in libraries for favorite Google Workspace applications like Gmail, Calendar, Drive, and more. There's nothing to install—we give you a code editor right in your browser, and your scripts run on Google's servers. If you're new to JavaScript, Codecademy offers a number of JavaScript courses. (Note that these courses weren't developed by and aren't associated with Google.) What can Apps Script do? Apps Script is versatile. Your first script Build and run a simple standalone script that creates a Google Doc and emails you a link to it. Set it up To build the script, follow the steps below. Try it out To execute the script, follow the steps below. Learn more To continue learning about Apps Script, take a look at the following resources:

Big Updates for Apps Script Today at Google I/O, we announced many enhancements to Google Apps Script to help you build richer applications and share your apps with users. Apps Script began as a tool for helping users get more done with their Google spreadsheets. Over time, Apps Script has grown to handle much more. We launched as a destination for Apps Script developers. HtmlService can help you create beautiful interfaces using Apps Script. We also launched a better way to store your application's data, ScriptDb . There are also now more options for deploying your web app. Finally, we wanted to make it easy to distribute your apps. We added a lot of new functionality to Apps Script, so in addition to our developer reference documentation , we've also created a new user guide . Building with Google Apps Script has become a lot easier and more powerful.

Introduction - Google Caja The Caja Compiler is a tool for making third party HTML, CSS and JavaScript safe to embed in your website. It enables rich interaction between the embedding page and the embedded applications. Caja uses an object-capability security model to allow for a wide range of flexible security policies, so that your website can effectively control what embedded third party code can do with user data. The Caja Compiler supports most HTML and CSS and the recently standardized "strict mode" JavaScript version of JavaScript -- even on older browsers that do not support strict mode. Benefits of using Caja New JavaScript Features.

JavaScript Client Library for Google APIs Alpha version released By Brendan O’Brien and Antonio Fuentes, Google Developer Team Today we reached another milestone in our efforts to provide infrastructure and tools to make it easier for developers to use Google APIs: we have released the Google APIs Client Library for JavaScript in Alpha. This client library is the latest addition to our suite of client libraries, which already includes Python, PHP, and Java. This compact and efficient client library provides access to all the Google APIs that are listed in the APIs Explorer. The client library is also flexible, supporting multiple browser environments including Chrome 8+, Firefox 3.5+, Internet Explorer 8+, Safari 4+, and Opera 11+. In addition, the JavaScript client library supports OAuth 2.0 authorization methods. You can load the client library using the following script tag: Loading an API and making a request is as easy as executing: To get started, visit the JavaScript Client Library documentation page.

Using the JavaScript Client Library (v2.0) - Google Data APIs Warning: This page is about Google's older APIs, the Google Data APIs; it's relevant only to the APIs that are listed in the Google Data APIs directory, many of which have been replaced with newer APIs. For information about a specific new API, see the new API's documentation. For information about authorizing requests with a newer API, see Google Accounts Authentication and Authorization. This document describes how to use the JavaScript client library to send Google Data API queries and interpret returned responses. Google provides a set of client libraries, in a variety of programming languages, for interacting with services that have data APIs. This document provides some general information about using the JavaScript client library, along with a set of examples of common uses. This document is intended for JavaScript programmers who want to write client applications that can interact with Google Data services. If you're new to JavaScript, the control flow may be a little confusing.

Getting Started - Google APIs Discovery Service The Discovery API provides a list of Google APIs for retrieving a machine-readable "Discovery document" metadata for each API. This document is intended for developers who want to write client libraries, IDE plugins, and other tools for interacting with Google APIs. Discovery Service Background Concepts The Google APIs Discovery Service is built upon two basic concepts: APIs Directory: A list of all APIs that are supported by the APIs Discovery Service. Data model A resource is an individual data entity with a unique identifier. APIs Directory List: A list of APIs Each directory entry contains an API name/version pair with the following information: Discovery Document resource: A machine-readable description of a particular API In addition to the information provided in the APIs Directory, a Discovery document also includes: The single Directory Collection is the conceptual container of the single APIs Directory resource, and the Discovery Document resources for each supported API. Operations

Using the API - Google APIs Discovery Service Contents Introduction This document is intended for developers who want to write client libraries, IDE plugins, and other tools for interacting with Google APIs. The Google APIs Discovery Service allows you to do all of the above by exposing machine readable metadata about other Google APIs through a simple API. All calls to the API are unauthenticated, JSON-based, REST requests that use SSL, i.e. If you're unfamiliar with Google APIs Discovery Service concepts, you should read Getting Started before starting to code. Discovery document format This section gives an overview of the Discovery document. All the examples below use the Discovery document from the URL Shortener API. GET Try it now in APIs Explorer! The format of a Discovery document includes information that falls into six main categories: Basic description of the API. Each of these Discovery document sections is described below. Basic API Description Authentication

Performance Tips - Google APIs Discovery Service This document covers some techniques you can use to improve the performance of your application. In some cases, examples from other APIs or generic APIs are used to illustrate the ideas presented. However, the same concepts are applicable to the Google APIs Discovery Service. Another way to improve the performance of your API calls is by requesting only the portion of the data that you're interested in. Partial response By default, the server sends back the full representation of a resource after processing requests. To request a partial response, use the fields request parameter to specify the fields you want returned. Example The following example shows the use of the fields parameter with a generic (fictional) "Demo" API. Simple request: This HTTP GET request omits the fields parameter and returns the full resource. Full resource response: The full resource data includes the following fields, along with many others that have been omitted for brevity.

APIs Console One account. All of Google. Sign in to continue to Google Cloud Platform Find my account Forgot password? Sign in with a different account Create account One Google Account for everything Google Developer's Guide Overview - Google Data APIs Warning: Most newer Google APIs are not Google Data APIs. The Google Data APIs documentation applies only to the older APIs that are listed in the Google Data APIs directory. For information about a specific new API, see that API's documentation. Google's mission is to organize the world's information and make it universally accessible and useful. The Google Data Protocol provides a secure means for external developers to write new applications that let end users access and update the data stored by many Google products. This set of documents is intended for anyone who wants to understand Google Data Protocol. If you're looking for the Developer's Guide for a specific API, visit the Google Data Protocol API Directory. If you want to access an API in your favorite programming language, visit the Client Libraries download page. A number of Google products, such as Calendar and Spreadsheets, provide APIs that are based on the Google Data Protocol. Protocol Version 2.0 vs. HTTP ETags.

Authentication and Authorization in the Google Data Protocol - Google Data APIs Warning: Most newer Google APIs are not Google Data APIs. The Google Data APIs documentation applies only to the older APIs that are listed in the Google Data APIs directory. For information about a specific new API, see that API's documentation. For information about authorizing requests with a newer API, see Google Accounts Authentication and Authorization. Third-party applications often require limited access to a user's Google Account for certain types of activity. Authentication services allow users to sign in to your application using a Google Account. Authorization services let users provide your application with access to the data they have stored in Google applications. Authentication and authorization services are often referred to collectively as auth. Authentication and authorization for Google APIs allow third-party applications to get limited access to a user's Google accounts for certain types of activities. Contents OAuth - authorization for web and installed applications

Resumable Media Uploads in the Google Data Protocol - Google Data APIs Eric Bidelman, Google Apps APIs team February 2010 Current web standards provide no reliable mechanism to facilitate the HTTP upload of large files. As a result, file uploads at Google and other sites have traditionally been limited to moderate sizes (e.g. 100 MB). For services like the YouTube and the Google Documents List APIs which support large file uploads, this presents a major hurdle. The Google Data resumable protocol directly addresses the aforementioned issues by supporting resumable POST/PUT HTTP requests in HTTP/1.0. This document describes how to incorporate Google Data's resumable upload feature into your applications. Initiating a resumable upload request To initiate a resumable upload session, send an HTTP POST request to the resumable-post link. The body of your POST request should be empty or contain an Atom XML entry and must not include the actual file contents. Here is another example request that instead uploads a word document. HTTP/1.1 200 OK Location: <upload_uri>

Tutorials - Google Apps Script These tutorials are designed to help you start using Google Apps Scripts more quickly. Some of these tutorials focus on the basics, some provide an in-depth analysis of a complex script, while others address specific nuances of the Google Apps Script system itself. Basics and working with Google Sheets Your First Script - This tutorial covers the basics of writing and executing a script, demonstrating how to create a Google Document and send an email. Integration with other services Creating a Google Site - This tutorial shows how to gather data from Gmail Contacts and Calendar to create a Google Site for our fictional soccer team. Workflows and end-to-end examples Creating a Tournament Bracket - This tutorial shows you how to use the Spreadsheet service to create Tournament Brackets similar to College Basketball's March Madness. Older tutorials (no longer maintained)

Apps Script Case Studies - Google Apps Script Gmail Meter by Romain Vialard, Revevol Gmail Meter is an Apps Script which runs on the first day of every month and sends you an email containing different statistics about your Inbox. Similar to how the Google Account Activity gives key stats about how you’ve used your Google Account, Gmail Meter gives you various statistics that will help you analyze your Gmail habits. Gmail Attachment Size by Amit Agarwal, Digital Inspiration Use Google Apps Script to connect to your Gmail account and compute the size of every message that’s present in your mailbox. Grading Made Easy by Dave Abouav, Flubaroo is designed as a simple grading solution for teachers using existing tools they're already comfortable with. Gmail Attachments to Drive Imagine this. 4 Ways to do Mail Merge by James Ferreira, by Steve Webster, Dito by Romain Vialard, Revevol Creating customized emails is very easy using Apps Script. Gmail Snooze by Corey Goldfeder, Google Approval Workflow Idea Bank