Apps Script Examples

Find the Apps Script code you’re after with these examples and tutorials. Click the link to view the article.

Want to see a specific example? Drop me a line here.

New to Apps Script?

> Guide to getting started with Apps Script (for absolute beginners)

General Apps Script Examples

> Saving data in your Google Sheets with Apps Script

> How to set up time-based triggers to run your Apps Script code

> How to add a hyperlinked index sheet to your large Google Sheet workbooks

> How to add a hyperlinked index into a sidebar of your Google Sheet workbooks

Integration Apps Script Examples

> Guide to getting started with APIs using Apps Script

> Google Sheets Slack bot: how to push data from your Google Sheets into the popular messaging app

> Google Sheets and D3 charts

> How to extract email addresses tagged with a specific Gmail label

> How to reply to Google Forms survey responses quickly with Sheets & Apps Script

> Connecting to the Crunchbase API with Google Sheets

> Google Sheets and Mailchimp integration using Apps Script

> How to get data from E-junkie into Google Sheets

> Show data from the GitHub API in Google Sheets, using Apps Script and Oauth

Data Visualization Examples

> How to automatically create waterfall charts using Apps Script

> How to automatically create funnel charts using Apps Script

> Recreating Tufte’s famous temperature chart with the Google Chart API

> Animated temperature chart using the Google Chart API

> One way to animate a chart in Google Sheets

Data Studio Examples

> Community Connectors: Access all your data in Google Data Studio

Find me on GitHub here.

16 thoughts on “Apps Script Examples”

  1. Hello, Ben

    Thank you for the info shared on scripts for Google Sheets, was really helpful to get me stared on getting a few things fixed in my sheets.

    By the way, do you perhaps have a fix to have Grouped Columns and Rows as available in Excel for Google Sheets/


  2. Dear Ben,
    Very interesting post and useful. I want to know is it possible to build web app that act as database with webpage at front end and spreadsheet at back end. Something similar to ms access?

    Thank you

  3. Hi Ben,

    I want to create a script that forwards an email to my evernote email address when I add a label and then changes the label to completed when done so.

    Does anything exist like this I can amend. Or where do I start?

    Many thanks for your cool info.



    1. I don’t know if this specific example exists anywhere, but it sounds totally plausible. Looks like people have done something similar before though, so this might be a place to start:

      The Gmail Service docs will be pretty helpful for this too:

      Hope that helps!

  4. Dear Ben,
    I need a script to know from Sreadsheet if a file exist in drive. for example in column “b” i have “123.pdf” and i need that a script looking for that name into drive and if it exist put on column c “yes”, else put “Not”
    maybe can u help me?


  5. Hi Ben

    Great site and article, thanks for this!

    I need to scan a lot of sheet files looking for data in cells.
    Is there a way to read (or write) sheet files without them having to be open in the browser?


  6. Buen dia desde Perù ante todo darle las gracias por las clases y videos que imparte, quiero por favor merecerle una consulta. Se pueden programar un trigger con un script de modo que actúen de acuerdo a un evento por ejemplo que se envíe email al tener una cantidad por decir cada 20 personas (en una hoja de cálculo) automáticamente, gracias de antemano

    1. Per Google translate: “Good day from Peru, first of all, to thank you for the classes and videos that you teach, I would like to thank you for your kind words. You can program a trigger with a script so that they act according to an event, for example that emails are sent by having an amount per say every 20 people (in a spreadsheet) automatically, thanks in advance”

      Hi! And thanks for sharing your thoughts. 🙂

  7. Hi Ben,
    I need to Create SpreadSheet to track status report of my teamMembers in a single tab.
    We are a team of 35people and currently everyone sends their daily task status (list of tickets handled; tasks performed all day etc) by email to Our Co-ordinator.
    The co-ordinator than have to manually copy contents of each mail, consolidate them in a single mail, and send overall status to higher management to show progress from our center.

    I tried my hands to implement this using google spreadsheet, but due to little exposure to codes n all, i had no luck.

    Below is what i planned –>
    A) create separate tab for each team member to update their corresponding status in respective tab (tab can be protected by each user so that he/she can only edit it)
    B) Consolidate all entries in all tabs in a single tab (say Final Status). this would display status from each tabs in a single page and co-ordinator will simply copy that tab and send mail

    problems –>
    How can I consolidate each status from each tab in a single tab?
    i tried looking for available scripts/functions but did not came across anything helpful

    Respective user can follow different approach to fill their status in their tab . how can I make sure all status are copied (say person A will use abc font, space, lines etc etc ..person B use xyz fonts, and can feel to represent task status in broad, coloured text etc)

    Sorry its lot to ask, but looking forward to solution 🙂

    Thanks in advance

  8. Hello!
    I want to code a script that shows an URL in the sidebar of a Google sheet.In fact for a Google Doc have the Google sidebar near and search/navigate through pages in the same window(not another tab,window) in the same one like an interactive search.I started to code and I have this :

    function onOpen() {

    .addItem(‘Google search ‘, ‘openDialog’)

    function openDialog() {
    var html = HtmlService.createHtmlOutputFromFile(‘INDEX’);
    var s =””
    function doSomething() {
    var response = UrlFetchApp.fetch(“”);

    and the html file is this one:;

    When I ckick on view->logs i have the source code of the google but i don’t know how th show the page and I wonder if it exists a method to have this.Thanks in advance.

  9. Hi Ben,

    my congratulations, you’re doing a great job helping all of us to take advantage of the inmense power of google sheets.

    Could you give me some advice about how can I access some data from a webpage? More specific: I need to access the References and the Citations to a paper indexed by SCOPUS. I have the URL (example:, and insert them into a Google sheet.

    Thanks in advance

  10. Ben,
    I am very new scripting / coding and am currently faced with this challenge –
    Create a web-based application and run it in containers.
    Can use any language but not sure where to start. i need to publish in GitHub and manipulate some data store / DB.

    Thanks in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *