Ever wish that you could tell people something when they open up your Google Docs? Maybe “Make a copy of this document, answer the questions and share it with your teacher!” or “This is a draft!”
Well, it’s possible. Some simple coding in the script editor and you can make it happen. I know that some of you are thinking “Simple . . . . coding. . . !?” while making this face, but it’s true. Just follow the steps below and you’ll make it happen.
Before we jump into the how, or what it looks like, a few notes:
- Only Editors will be able to see the popup. In my testing, someone who is “can view” or “can comment” does not see the popup. Also, they have to be explicitly shared as editors, not just “anyone with the link can edit.”
- If you copy the document within your own account, the popup will appear on the copy as well.
- If someone shared on the document makes a copy, the popup will NOT appear on their copy.
- If you send the document out on Google Classroom as “Make a Copy for Each Student” it will NOT include the popup in those copies. I was bummed when I discovered this, because it would have been huge for teachers.
Now that you know those notes and limitations, let’s dive into it. First, an animated GIF of how to do it and then, below the GIF, the step by step with code that you can just copy and paste.

Step-by-Step Instructions:
- From within your Google Doc, click on Tools > Script Editor.
- Click on Untitled Project and rename the project.
- Replace the words myFunction with onOpen. (This is what tells it to run automatically)
- After the { type DocumentApp. (include the period)
- From the menu that pops up select getUi : Ui
- After {DocumentApp.getUi() type a period.
- From the menu that pops up select alert(String prompt) : Button
- In place of the word prompt type your popup message.
- Add quotation marks around your message (and inside of the parentheses).
- Click the save icon.
- Go back to your Doc, refresh and check it out!
Another note: You can actually edit the appearance of the popup with some HTML and CSS coding, but that would take me longer to explain that 1 GIF can handle!
Credits: I learned this from one of Google’s Applied Digital Skills Courses in the “Code Welcome Screen” Activity. You can learn about adding some formatting to your popup in that course.