100 Google Apps Script Snippets to Supercharge Your Google Docs

Google Docs is an incredible tool for writing, collaboration, and documentation—but did you know you can unlock even more power with Google Apps Script? With just a few lines of code, you can automate repetitive tasks, enforce formatting standards, analyze content, and streamline your workflow.

On Github at https://github.com/lsvekis/Apps-Script-Code-Snippets

Today, I’m sharing 100 ready-to-use Google Apps Script code snippets that will save you hours and take your documents to the next level. Whether you’re a teacher, student, technical writer, or productivity enthusiast, these scripts are for you!


🚀 Why Use Google Apps Script with Docs?

  • Automate repetitive or complex formatting
  • Batch process large documents in seconds
  • Enforce consistency and clean up messy imports
  • Analyze content for statistics, structure, or quality
  • Customize your experience far beyond what menus offer

🛠️ Getting Started

  1. Open any Google Doc.
  2. Go to Extensions → Apps Script.
  3. Delete any code in the editor and paste your chosen script.
  4. Save and click the “Run” button (you may need to authorize).
  5. Mix and match scripts, or build your own toolbox!

📖 The Ultimate List: 100 Apps Script Snippets

Grouped by function for easy browsing!


🔥 1–10: Essentials & Text Cleanup

  • Remove All [cite: 1234] References
  • Convert “Exercise” Sections to Heading 2
  • Find and Highlight All TODOs
  • Replace All Instances of a Word
  • Add Table of Contents at Top
  • Remove Extra Blank Lines
  • List All Images with Their Index
  • Count Words in Your Document
  • Change All Headings to Title Case
  • Insert Current Date Anywhere

🎨 11–30: Formatting and Layout

  • Duplicate the Active Document
  • Get a List of All Headings
  • Export Document as PDF and Email
  • Remove All Hyperlinks
  • Capitalize All Paragraphs
  • Count All Images
  • Convert All Text to Arial
  • Remove All Comments
  • Insert a Footer
  • Insert a Header
  • Highlight All Email Addresses
  • Double-space Paragraphs
  • Add Page Numbers to Footer
  • Insert Image by URL
  • Find and Bold All Numbers
  • List All Bookmarks
  • Remove All Bookmarks
  • Merge All Tables into One
  • Count All Tables
  • Add “Draft” Watermark to Header

🏷️ 31–50: Headings, Styles & Links

  • Center Align All Headings
  • Remove All Bold Formatting
  • List All Links
  • Insert a Horizontal Line
  • Add “Reviewed” to Document Title
  • Replace All Numbers with “#”
  • Add Indentation to All Paragraphs
  • Remove All Indentation
  • Append Text at the End
  • Insert Current User’s Email
  • List All Unique Words
  • Delete All Tables
  • Highlight All Headings
  • Italicize All Quoted Text
  • Add Hyperlink to a Selected Word
  • Replace Tabs with Spaces
  • Remove All Underlines
  • List Paragraphs >100 Characters
  • Set All Text Color to Black
  • Make All Headings Bold

🧮 51–70: Counting, Analysis & Randomization

  • Log All Paragraph Styles
  • Set Document Font Size to 12
  • Remove All Strikethrough
  • Highlight Paragraphs Containing “Important”
  • Add 3×3 Table
  • Remove All Tables Except First
  • Add Timestamp to End
  • Highlight All Numbers Over 100
  • Insert Line Breaks After Each Sentence
  • Add Confidential Footer
  • Set Paragraphs to Single Spacing
  • Find Paragraphs Starting “Note:”
  • Convert All Text to Sentence Case
  • Insert Blank Page at End
  • Insert Table of Figures Placeholder
  • Add Horizontal Line After Every Heading
  • Highlight Unique Words >10 Letters
  • Remove All Images
  • Add a Cover Page
  • Randomize Paragraph Order

🧹 71–90: Content Modification & Clean Up

  • Replace “lorem” With “ipsum”
  • List Paragraphs Containing a Number
  • Delete Paragraphs with “delete me”
  • Make All Links Blue
  • Number All Headings Sequentially
  • Highlight Palindromes
  • Log Document Creation Date
  • Remove All Formatting
  • Duplicate First Paragraph
  • Move All Headings to Top
  • Insert Blank Paragraph After Each Heading
  • Replace All Exclamation Marks with Periods
  • Add “Summary” Section at End
  • Bold All Proper Nouns
  • Insert Word Count at Top
  • Divider After Each Table
  • Log All Paragraph Indentations
  • Remove All Empty Headings
  • Highlight All Dates (YYYY-MM-DD)
  • Log All Tables and Their Size

📝 91–100: Polish & Advanced Tricks

  • Make All Text 1.5 Line Spaced
  • Highlight All Questions
  • Insert Headings Index at Top
  • Log All Paragraph Alignments
  • Convert All Uppercase Words to Lowercase
  • Highlight All Headings with Custom Color
  • List All Section Breaks
  • Highlight All Capitalized Words
  • Remove All Paragraph Background Colors
  • Add “Appendix” Section at End

💡 Pro Tips

  • Batch tasks: You can chain multiple snippets for bulk actions (e.g., cleanup + formatting + analysis).
  • Undo: If you make a mistake, just use Google Docs’ Undo button.
  • Explore: Mix and match, or combine logic to build your own custom solutions!

🎯 Conclusion

Google Apps Script opens up a new world of document automation and customization. With these 100 snippets, you can tackle just about any Docs workflow, from formatting to data analysis to bulk editing. Bookmark this post, share with your colleagues, and start automating your Google Docs today!

Got your own favorite script or want a deep-dive on how to write your own?