
Here’s how it appears in the completed script: Be sure to keep the quotes to ensure your dataSpreadsheetUrl variable is a string. You’ll replace “full url here!” with the actual URL of the spreadsheet, including the /edit at the end. Let’s declare the files we are working with: The variable name will then be used within the functions. To more easily switch out spreadsheet URLs, we will put the URL into its own variable.
#Arraysync slide show full
It will likely be easier for all team members to use the full URL of their Sheets, so we will use that method for Sheets. Since we are working out of a Slides container, we will use getActivePresentation().

If your script is contained within a Spreadsheet, you can use getActiveSpreadsheet(). Accessing Your Apps in The Scriptīoth the parent classes we are working with can use the following methods for opening them. The “Return Type” in the methods documentation is key to ensure your output is the type you need and expect. When reviewing the documentation you’ll see that sometimes these classes can be children or siblings, which makes for a messier hierarchy. We will also be using the Slide, Shape, PageElement, and TextRange classes. The Slides service is SlidesApp, which works with the Presentation class. These classes have a nicely defined hierarchy, as pictured below. While there are many classes within, we will be using the Spreadsheet, Sheet, and Range classes. Sheets Classesįor Google Sheets, everything begins with the parent class SpreadsheetApp. Once you understand the hierarchy, you can then move about the app and reference the appropriate class documentation (which will be linked each time a new class is referenced here), to determine what properties and methods are available for the class. **THIS IS THE MOST IMPORTANT ASPECT OF USING GOOGLE APPS SCRIPT!**Įach app has a hierarchy of classes. Instead, you’ll have to understand the different classes for the various apps. The biggest difference, though, is that you won’t be traversing a DOM. For starters, using Logger.log instead of console.log. However, there are a couple of differences. Understanding the Google Apps Script Classesįor those of you savvy in JavaScript, you may think you are ready to get coding. To see the outputs of your variables, use “Logger.log().” Access the logs from within the View menu. Once it is stopped (and provided that no error message has appeared), your script should have completed!Īs you update, make sure you are saving! When you have unsaved changes, a little red asterisk will appear. When a script is running, you’ll see an alert at the top of the editor.

Once approved, the script should continue running.
/powerpoint-5a3325870c1a8200364a5eba.jpg)
As long as you trust the code, you will need to open the Advanced options and go ahead to the function. If you are running a script from a copy of someone’s container (like this example), you might see a screen before the above approval telling you Google hasn’t verified the source (but we are right now so you know there isn’t any malicious script!). The first time you run your script, you will be required to allow Google the ability to view, edit, etc your apps. While you could just dive right in and run the script (just push play) within this container, let’s go over how it works, so you can start customizing it for your own needs. Once you’ve got your container set up, just open Tools > Script Editor to start writing your function. Make a copy of this container presentation It will have a title slide and then a slide that will serve as a template. The container usually has some initial setup for the script too.įor our case, our container will be a Google Slides file. The first thing to understand about the Google Apps Script is that the script needs to be built into a “container,” which is a file of the G Suite Service that will contain the script to be run.

Getting Started In Your Container’s Script Editor We will use an export of the Behavior > Landing Pages report from Google Analytics and generate a slide for each page in the report with the metrics bulleted out. Let’s say your executive wants to be able to see how well inbound marketing is working, but doesn’t want to look at a giant table of URLs stacked on top of each other. With Google Apps Script, you can inject data from Google Sheets into a template in Google Slides and generate hundreds of pretty slides in just minutes. Now comes the hours and hours spent copying over information into a presentation. But what happens when an executive wants to know more about that project you are notating from a data export? You have to turn your mind-numbing spreadsheet with filters and color coding only you might understand into a more digestible format. Working on websites, we work in rows and rows of data.
