温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.muo.com/google-sheets-apps-script-hack/
点击访问原文链接

Apps Script for Google Sheets Is the Productivity Hack You’re Missing

Apps Script for Google Sheets Is the Productivity Hack You’re Missing Menu Sign in now Close PC & Mobile Submenu Windows2 Linux Android Apple Technical Submenu Tech Explained Security Software Submenu Productivity Internet Creative Screen Submenu Entertainment Streaming Home Submenu Smart Home Home News Sign in Newsletter Menu Follow Followed Like Threads More Action Summary Generate a summary of this story Sign in now Productivity Android Smart TVs Networking Windows 11 Entertainment Close
Apps Script for Google Sheets Is the Productivity Hack You’re Missing Credit: Chifundo Kasiya/MUO By  Chifundo Kasiya Published Jul 19, 2025, 7:00 AM EDT Chifundo is a writer for MakeUseOf. He initially studied banking but discovered a passion for writing and became a freelance writer in 2017. He has written articles, blogs, essays, and web content for dozens of clients on Upwork, as well as high-authority sites like How-To Geek and Make Tech Easier.

Chifundo loves that writing allows him to learn and explore different topics and turn them into engaging, easy-to-understand content that helps people.

He mainly writes for Windows on MakeUseOf, having been a Windows user since Windows 98. He has helped people solve Windows problems at home and in the organizations he has worked for. He loves to help people understand various Windows features to use the OS to its full potential.

In his spare time, Chifundo loves to design and code video games. He mainly focuses on 2D games and dreams of becoming an indie developer. He also does pixel and vector art, which he uses for his personal projects. Sign in to your MakeUseOf account

Google Sheets can do a lot—but with Apps Script, it does everything. I’d been using Sheets for years without touching this feature. Once I did, I started automating the chores I didn’t even realize were slowing me down.

Automating Boring Tasks

If you're tired of repeating the same task over and over again in Google Sheets, whether it's inserting a date, cleaning up text, applying formatting, or exporting data, Apps Script can help you automate that.

For instance, you can easily insert the current date in Google Sheets by pressing Ctrl + ; on Windows or Cmd + ; on Mac. But if you need it to be in a particular format like yyyy-MM-dd, you must use a formula or do some manual formatting. With Apps Script, you can create a function that gets the current date, formats it as desired, and then inserts it into the selected cells.

You only need to do this once, and you can reuse it wherever you need it. Here is an example of what the script would look like:

function insertCurrentDate() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var selectedCell = sheet.getActiveCell();
var currentDate = new Date();
var formattedDate = Utilities.formatDate(currentDate, Session.getScriptTimeZone(),'yyyy-MM-dd');
selectedCell.setValue(formattedDate);
}

If you are following along, I will show you how to run the above code from within a spreadsheet in the next section.

Create Customized Spreadsheets

One way Apps Script helps you customize your spreadsheet is by letting you create specialized tools that streamline your workflow. For instance, you can insert a button that applies formatting or performs advanced calculations, or create dashboards that help you to easily analyze your data. These capabilities are far beyond anything Google Sheets can do on its own.

Continuing with our example from the previous section, we can add a custom menu item that allows us to run the function from within the spreadsheet. Here is the script that does that (insert above the function in the previous section):

function onOpen(){
var ui = SpreadsheetApp.getUi();
ui.createMenu('My Menu').addItem('Insert Current Date', 'insertCurrentDate').addToUi();
}

Once you run this code in Apps Script and refresh Google Sheets, you will see My Menu appear in the top menu. Now, you can insert the current date in a selected cell by clicking My Menu > Insert Current Date.

Screenshot by Chifundo Kasiya—No attribution required  Perform Specific Calculations Through Custom Functions

Google Sheets doesn't always have the functions you need to perform specific calculations. In cases like these, creating your own function using Apps Script, inserting the calculation into it, and using it within the sheet (just like you would any other) is the way to go. This also means that you don't have to repeat the complex calculations throughout the script, making your spreadsheet cleaner and more readable.

Related 30+ Essential Google Sheets Functions

Manipulate your Google Sheets data and simplify processes with these handy functions, available in a free downloadable cheat sheet.

Posts By  Brandon Cranmer

Consider the function below that accepts a date and checks how many days have passed since the current day (similarly to calculating the difference between two dates) to determine the due date:

function CHECKDUEDATE(inputDate) {
var today = new Date();
var timeDiff = today - inputDate;
var daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));

if (daysDiff 0) {
return "Due in " + daysDiff.toString() + " days!"
} else {
return "Due today!"
}
}

Depending on the date entered, it says if it's overdue, if the days difference is less than zero, how many days are left if greater than zero, or due that day if equal to zero.

The best part of Apps Script is that you can create a time-based trigger that runs the function at a specific time (e.g., midnight) to dynamically update the due date. It can even be used for conditional formatting—the possibilities are many.

You Can Use Apps Script with Other Google Services

Apps Script allows you to integrate your spreadsheets with other Google services, including Gmail, Google Drive, and Google Docs. This capability enables you to build comprehensive workflows that span multiple tools in the Google ecosystem.

Here is an example script that extracts the body text from a Google Docs document and inserts it into cell A1:

function getBodyTextFromGoogleDoc() {
const doc = DocumentApp.openById("insert Google Docs ID here");
const bodyText = doc.getBody().getText();

const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const targetRange = sheet.getRange("A1");

targetRange.setValue(bodyText);
}

Be sure to replace insert Google Docs ID here in the second line with the ID of the Google Docs document you want to get the body text from (don't remove the parentheses).

Apps Script Is Not That Hard to Learn

If you have some basic programming knowledge, Apps Script is particularly easy to learn. This is especially true if you're familiar with JavaScript, as that is the primary language used by the platform. You can start slowly with simple automations and tasks (basic calculations and sending an email), and build up from there.

Screenshot by Chifundo Kasiya—No attribution required

Even if you've never written code in your life, Apps Script can be a great way to learn. Since you'll mainly be using it to automate tasks in Google Sheets, you will see results instantly, which is a great motivator. With that said, you still need to learn basic programming concepts (e.g., variables, loops, and functions)—Google has great tutorials, and Apps Script has a supportive community behind it to assist you.

Furthermore, there is no need for a complicated setup, as it runs in the cloud. You don't need additional software or libraries.

Related These Free Websites Taught Me More Than Any Paid Course Ever Did

Paid doesn't mean better.

Posts By  Alvin Wanjala

Apps Script is just one of the many Google Docs features that you're missing out on and worth a try. The cool thing about Apps Script is that you can also use it in other Google Workspace apps like Docs and Slides. For instance, I created a simple text case converter in Google Docs since it doesn't have that functionality built-in.

Close
Thread Sign in to your MakeUseOf account

We want to hear from you. Share your perspective in the comments below, and please keep the conversation respectful.

Be the first to post Attachment(s) Please respect our community guidelines. No links, inappropriate language, or spam.

Your comment has not been saved

Send confirmation email

This space is open for discussion.

Be the first to share your thoughts.

Terms Privacy Feedback Recommended I'm sticking with my M1 MacBook until it dies—here's my plan and reasoning Windows’ built-in apps are holding you back—these 6 apps are better This Plex plugin made my library perfect I replaced Excel's PivotTables with this extremely overpowered tool and haven’t looked back Join Our Team Our Audience About Us Press & Events Media Coverage Contact Us Follow Us Advertising Careers Terms Privacy Policies MakeUseOf is part of the Valnet Publishing Group Copyright © 2026 Valnet Inc.

Apps Script for Google Sheets Is the Productivity Hack You’re Missing,AI智能索引,全网链接索引,智能导航,网页索引

    Don