


Enhance Google Docs and Sheets Productivity with Scripts and Macros
This article has been updated since its original publication on November 26, 2018.
Google Drive offers more than cloud storage; it provides a powerful office suite including Docs and Sheets. While these web apps are designed for speed and ease of use, their functionality can be significantly boosted with scripts and macros.
JavaScript-based scripts add extra features. Imagine automating invoice generation in Sheets or rapidly converting Docs files to PDFs.
Macros are specialized scripts—sequences of actions triggered by a single keystroke or click. They streamline repetitive tasks, such as applying consistent formatting to large text blocks or duplicating spreadsheet rows. Mastering scripts and macros unlocks significant productivity gains.
Adding Scripts to Google Apps
Proficient JavaScript users can write their own scripts. In Docs or Sheets, navigate to Extensions > Apps Script. This opens the Apps Script editor where you can create new scripts or execute existing ones (using the Run button). Even without coding skills, you can leverage pre-built scripts.
Numerous Google app add-ons are available online. Some provide complete installation instructions, others require copying and pasting code into the script editor. Here are a few useful examples:
- Mail Merge: Populates Gmail drafts with data from a Google Sheet. Google provides guidance, but you can customize the code (e.g., adding BCC/CC recipients).
- Website Monitor: Logs website uptime/downtime, tracking load times and detecting outages. The script is embedded in a Google Sheet; simply adjust parameters (like the URL) and run.
- Invoice Generator (SheetGo): Transforms Google Sheet rows into invoices. Enter data (company details, payment amounts) into the sheet, and the script generates a PDF invoice. The code is relatively straightforward, making customization easy.
After importing scripts, manage them via the Apps Script web portal. The information icon (a circled "i") displays usage frequency. To modify a script, click on it. Always back up scripts before editing by selecting the file options (three dots) and choosing Make a copy.
While learning to code your own scripts takes time, resources like this Zapier blog post offer valuable guidance for beginners.
Creating Custom Shortcuts with Macros
Macros extend script functionality. Recording a macro generates a script automating repetitive actions, creating a mini-application for time-consuming tasks.
Currently, macros are available in Sheets but not yet in Docs or Slides. They're a long-standing feature in Microsoft Office (Word, Excel), automating formatting, data entry, and other repeated actions.
To create a Sheets macro, open a spreadsheet and go to Extensions > Macros > Record macro. The recording starts immediately. Perform your task as usual, then click Save to store it or Cancel to discard it.
During recording, choose between Use absolute references (macro runs from the same location) and Use relative references (macro runs relative to the currently selected cell). For example, use absolute references to consistently format the top row; use relative references to format cells relative to the selection.
After saving, name the macro and assign a keyboard shortcut (optional). Access and manage macros under Extensions > Macros. The Manage macros option allows renaming, re-assigning shortcuts, deleting, or viewing the code in the Apps Script editor. Examining the code helps understand the actions performed.
Google requires permission before running a macro due to potential security risks. Always verify the macro's origin before granting permission.
The above is the detailed content of Work faster in Google Docs and Sheets by creating your own shortcuts. For more information, please follow other related articles on the PHP Chinese website!

Are you encountering the "Fmod_event64.dll is missing" error on your Windows system? If this issue is causing you confusion, you're in the right place. This article from MiniTool will not only guide you on how to resolve this problem but al

ELEX II is an open-world action RPG developed by Piranha Bytes and published by THQ Nordic. It was released in March 2022 as the sequel to the original ELEX, ex

When using Ryzen Master, it’s common to receive the “unable to initialize; kindly reinstall. Hence, aborting” error message. This post from MiniTool introduces how to fix the “Ryzen Master unable to initialize” issue in 4 ways.Quick Navigation :Way 1

Are you dealing with the issue where File Explorer jumps to top of folder on its own? If yes, you’ve come to the right place. Check out this MiniTool guide for easy solutions and step-by-step instructions.Quick Navigation :File Explorer Jumps to Top

Are you using Canon cameras to capture excellent moments? Lost precious photos can be disappointing for every photographer. This MiniTool post shows a detailed guide on how to recover CRM files. Let’s go on together!Quick Navigation :About CRM FilesH

When playing Dune: Awakening, a BSOD error appears, and even your entire PC freezes. How to solve Dune: Awakening crashing PC during compiling shaders? You are not alone! MiniTool walks you through this guide to discover possible solutions to fix the

When you discover that the camera stopped working after Windows 11 24H2 update, what are you gonna do? If you are helpless, this MiniTool post is a lifeline for you. It introduces why it stopped working and how to get it back to work.Quick Navigation

If dropdown menus malfunction in Windows 11 or 10, it can be annoying, causing problems like menus not showing up, vanishing too fast, or appearing in the wrong places. This guide from MiniTool will help you resolve the “dropdown menus not working in


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 English version
Recommended: Win version, supports code prompts!
