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?
If you put a script into the wrong app, the script will not function.
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.
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
- Write a name for this apps script. What does this apps script do? A short name is good enough.
- Copy and paste the apps script you found the web to the white editor space.
- Click the save button. Check if there is any typo or errors in the apps script. Hopefully not.
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'); }
In addition to the script file, some apps scripts may contain html files too. It's easy to add them too, it's in File > New > HTML file. Afterwards, just paste the html content in.
A more complex apps script project may contains a group of script files and html files. Therefore, ensure you copied all source code to the script editor.
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.
- 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.
- 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"
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 in Google Apps Script.
Still confused on the tutorial? Leave your comment below.