You found an apps script on the web to add extra functionalities to your Google Docs but have no idea how to use it. In fact, you don’t have to be a programmer to do this. Having a basic understanding of how to add an apps script from the web is good enough. You don’t need to soak yourself into the code unless you’re really interested in how the code works.

This beginner tutorial is written for both technical and non-technical people, teaching you to add an apps script to Google Doc / Sheets / Forms / Slides. I tried to explain in plain text, not jargons.

Step 1. Know which type of Google Apps the apps script is running on

  • Ask yourself: What does the apps script do? Does it do something with google doc / sheets / forms / slides?

Step 2. Open your file and initiate script editor

The four types of productivity programs have their a script editor menu in the menu bar. It’s usually in Tools > Script editor. For Google Forms, it’s in the 3 dots menu.

the tools script editor menu in google doc
Script editor menu in Google Doc
the tools script editor menu in google sheets
Script editor menu in Google Sheets
the tools script editor menu in google slides
Script editor menu in Google Slides
the script editor menu in google forms
Script editor menu in Google Forms

Step 3. Add the apps script

  • As you clicked the Script editor menu, the script editor will open in a new tab.
  • Follow the steps shown in the screenshot
    1. Write a name for this apps script. What does this apps script do? A short name is good enough.
    2. Copy and paste the apps script you found the web to the white editor space.
    3. Click the save button. Check if there is any typo or errors in the apps script. Hopefully not.
the script editor interface with title and sample code pasted
The Script Editor Interface

No apps script at hand? Try this one.

function onOpen() {
  var ui = SpreadsheetApp.getUi();
  // Or DocumentApp or FormApp.
  ui.createMenu('xFanatical')
      .addItem('Say Hello', 'sayHello')
      .addToUi();
}

function sayHello() {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
     .alert('Hello you, welcome to xFanatical');
}

For more complex apps script projects, you may see multiple files, including html files too.

Complex apps script projects contain many files
Complex apps script projects contain many files

Step 4. Run the script now

  • Now go back to the tab of your google docs
  • Refresh the page
  • You will find some menus being added to your google docs / sheets / slide / forms menu, like the following. Depending on the features of your apps script, you see different menus. But try run it.
a custom menu is created by xfanatical in google sheets
The additional menu added by the apps script
  • Authorization. If an apps script needs access to sensitive data from your Google account, a dialog will pop up for the first time. We assume the apps script you downloaded from the web isn’t malicious, contact us if you aren’t sure. If you know it’s safe, then follow these steps.
    • In the Authorization Required dialog, click Continue.
    • In the Choose an account dialog, login with your google account on which the apps script will run.
    • There may be a warning dialog saying This app isn’t verified. Click Advanced, and Go to xxxx. (Unsafe).
    • Now you will see what permissions the apps script will ask for. Click Allow.
    • Now you’re done with the authorization.
Authorization required dialog
Authorization required dialog
Login with your google account to use the apps script
Login with your google account to use the apps script
This app isn't verified warning
“This app isn’t verified” warning
Permissions requested by the apps script
Permissions requested by the apps script
  • The apps script now officially runs. See what you got from the sample apps script I shared with you above. It pops up a dialog saying “Hello you, welcome to xFanatical”
a dialog pops up in the google sheets by running the apps script
The final demo of Hello xFanatical

Conclusion

You have learned how to add an apps script to your google docs to add extra capability. Now discover free or premium apps scripts from xfanatical.com to power up your google docs for your business needs.

If you’re interested in programming, play and have fun inGoogle Apps Script.

Still confused on the tutorial? Leave your comment below.