Extend Google Docs, Sheets, and Forms with Apps Script
Apps Script also allows you to build web applications and interact with many other Google services, including AdSense, Analytics, Calendar, Drive, Finance, Gmail, and Maps.
Apps Script for beginners
You can also check out our gallery of Add-ons, script-based tools built by third-party developers, available in Google Docs and the new Google Sheets.
Apps Script for experienced programmers
Experienced developers should start with a quick introduction to Apps Script’s development environment. After that, the list of tutorials should give you a good idea of what’s possible, or you can jump straight into the reference documentation. We can’t wait to see what you build.
Custom menu items
Custom menus let you add new functionality to the familiar menu system. When the user clicks on a menu option, Apps Script runs a series of instructions (a macro) determined by the script’s author.
For example, a custom menu could include a command that produces a simple report from the data in a spreadsheet and then sends it in an email. This allows users to run scripts without opening the Script Editor or typing a formula.
To learn more about custom menu items and dialog boxes in Sheets, try this tutorial: Defining Spreadsheet Menus. To learn more about custom menu items, dialog boxes, and sidebars in Docs, see the guide to Extending Docs with Apps Script. You can customize the Google Forms editor using exactly the same techniques as Docs, but note that these customizations are only visible to the person who is creating the form, not in the view that form respondents see.
Apps Script in Sheets
A custom function (sometimes called a user-defined function) is similar to a spreadsheet formula like ‘=SUM(A1:A5)’ except that you define the formula’s behavior in Apps Script. For example, you could create a custom function, in2mm(), that converts a value from inches to millimeters, then use the formula in your spreadsheet by typing ‘=in2mm(A1)’ or ‘=in2mm(10)’ into a cell.
To learn more about custom functions, get started with this tutorial: Custom Functions in Spreadsheets.
Apps Script gallery
You don’t need to write a single line of code to use Apps Script with Google Sheets — instead, you can try using scripts that have been created by fellow users. In the old version of Google Sheets, you will find these in the Script Gallery. In the new version of Google Sheets, check out Add-ons, our new collection of popular scripts.
You’ll find that many popular scripts are already in the Add-ons gallery in the new version of Sheets. But, If you’re looking for a script you used in the old version of Sheets and can’t find it in the Add-ons gallery, try the following:
- Open a spreadsheet created in the old version of Sheets.
- Go to the Tools menu > Script manager.
- Copy the script you want to use in the new Sheets:
- Go to the Tools menu > Script gallery and click Install next to the script.
- Accept any permissions and close the script gallery.
- Go to the Tools menu > Script editor and copy the script code found there.
- Open a spreadsheet created in the new version of Sheets.
- Go to the Tools menu > Script editor.
- Click Spreadsheet and paste the script into the editor.
Mary is a Docs & Drive expert and author of this help page. Leave her feedback below about the page.