Step-by-step guide to run any Google Apps Script

Here's a step-by-step guide to get started with Google Apps Script even if you're new to scripting in Google Workspace:

Step 1: Open Google Apps Script

  1. Go to Google Drive: Open Google Drive.
  2. Click "New": On the top-left corner, click the New button.
  3. Select "Google Apps Script": Scroll down, click on More, then select Google Apps Script. This will open the Apps Script editor in a new tab.

Step 2: Start a New Script

  1. Name Your Project: At the top left, click Untitled project and enter a name.
  2. Delete Default Code: The default code function myFunction() {} can be deleted if you want to start fresh.

Step 3: Write Your First Script

  1. Type Code: In the editor, type your JavaScript-based Google Apps Script code. For example:
    function myFirstScript() {
    Logger.log("Hello, World!");
    }

Step 4: Save the Script

  1. Click "Save": Press File > Save, or use Ctrl + S (Windows) / Cmd + S (Mac) to save your script.

Step 5: Set Up Permissions (Authentication)

  1. Click "Run": Click the Run button (triangle icon at the top).
  2. Authenticate: A dialog will pop up asking you to review permissions. Click Review Permissions.
  3. Select Your Google Account: Choose the Google account you want to authorize the script to access.
  4. Click "Allow": Grant permission by clicking Allow. This will allow the script to access your Google account as specified in your code.

Step 6: Check Logs for Output

  1. Open Logs: After running the code, click on Execution log under View or press Ctrl + Enter.
  2. View Output: You should see the output of Logger.log("Hello, World!"); displayed here.

Step 7: Schedule the Script (Optional)

  1. Click on the Clock Icon: In the Apps Script editor, click the clock icon on the left panel.
  2. Set a Trigger: Choose + Add Trigger, select your function, and configure when you want it to run.

With this, you’ve set up and run your first Google Apps Script!

Learn more about Google Apps Scripts.

Published