Add a Popup Message to your Google Docs

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.

Add Popup Message to Google Docs Animation

Step-by-Step Instructions:

  1. From within your Google Doc, click on Tools > Script Editor.
  2. Click on Untitled Project and rename the project.
  3. Replace the words myFunction with onOpen. (This is what tells it to run automatically)
  4. After the { type DocumentApp. (include the period)
  5. From the menu that pops up select getUi : Ui
  6. After {DocumentApp.getUi() type a period.
  7. From the menu that pops up select alert(String prompt) : Button
  8. In place of the word prompt type your popup message.
  9. Add quotation marks around your message (and inside of the parentheses).
  10. Click the save icon.
  11. 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.

Published by

Jake Miller

Jake is a Google for Education Certified Trainer and is the Lead Technology Integration Specialist for Brady Middle School in Ohio's Orange City Schools. In the past he taught STEM, Science & Math in Stow-Munroe Falls, Ohio, where he was also a leader in the district's Technology Leadership Team and a co-advisor for the middle school's STEM Club. He has been an educator since 2003. His Bachelor's Degree is in middle-level education (math/science) from the University of Akron and his Master's Degree is in Instructional Technology from Kent State University. He has enjoyed providing more than 100 professional development opportunities at conferences and school districts across the state of Ohio. He is very involved in Twitter (@JakeMillerTech) and provides regular pointers for educators with his #GAFETip tweets.