Family Encyclopedia >> Work

How to automate repetitive tasks in Google sheets with macros

Record a task, save it and run it whenever you want.

Macros are finally available to Google Sheets users. Macros allow you to automate repetitive tasks in documents and spreadsheets without having to learn to write code.

They have been a core productivity tool in Microsoft Office for a long time. Excel users have always been able to use macros to save time, and now you can bring the same time-saving benefits to Google Sheets.

While Google Sheets has allowed users to write their own App Script functions, macros offer this type of functionality to all Google Sheets users, with no coding experience required.

Macros are particularly useful if you come across multiple sheets over and over again with similar data or information. For example, any kind of monthly trackers with fancy features to collect data will benefit from macros.

How to create a new macro in Google Sheets

Google Sheets macros are very easy to create.

  1. Click Tools> Macros> Record Macro .
  2. Run the steps you want to automate..
  3. Choose Absolute References If you want the macro to work on the exact same cell that you record. Choose Relative References If you want the macro to work on the cell you select and nearby cells.
    How to automate repetitive tasks in Google sheets with macros
  4. Click Save .
  5. Enter the name of the macro and an optional keyboard shortcut.

Now obviously step two in the list above could involve a lot more steps, but more on that later.

How to edit a macro in Google Sheets

If you want to edit your macro, do the following:

  1. Go Tools> Macros> Manage Macros .
  2. In the list of Macros that opens, click the menu button (three dots) next to the macro you want to edit.
    How to automate repetitive tasks in Google sheets with macros
  3. Click Edit Script .

To edit the macro, you'll need to edit the code, so if you're not comfortable with this, it may be easier to just re-record the macro.

How to run a macro in Google sheets

To run the macro, open the sheet you want to use and click Tools> Macros and select the macro from the list. Or if you assigned a keyboard shortcut to your macro, you can use that.

How to automate repetitive tasks in Google sheets with macros

Below are some simple examples of the various ways you can use macros in Google Sheets.

Example 1:Formatting your spreadsheet with a macro

Any kind of repetitive formatting that you need to apply to multiple Google Sheets can easily be done with macros.

Basic formatting

If you have multiple sheets with similar information, you can record macros for any or all of the following:bold/italic/underline, font size, text alignment, text wrapping, background fill color, and more.

How to automate repetitive tasks in Google sheets with macros

Conditional formatting

With Google Sheets, you can also get quite a bit meta, adding an extra layer of automation on top of the basic automation with Conditional Formatting.

You can use Conditional Formatting to format cells using the same methods listed above. The difference is that you can create a rule that formats the text based on specific criteria:

  • Whether or not the cell contains a specific keyword.
  • If the cell contains a number equal to, greater than, or less than a specified number
  • If the cell contains a specific date / a date after / a date before your specification.

So let's say you're using Google Sheets as a way to keep track of your tasks, and you've assigned due dates to your tasks. You can use conditional formatting to highlight what's due today:

  1. After clicking Save, select the cells you want to apply conditional formatting to.
  2. Go Format> Conditional formatting .
  3. In the sidebar that opens, click Add new rule .
  4. Under Format cells yes select The date is .
  5. In the second drop-down menu that opens, select Today for pending tasks today.

If you want to highlight something that is past due, repeat steps 1-3, and then do the following:

  1. Under Formatting cells if you select The date is before .
  2. In the second drop-down menu that opens, select Today .

Example 2:Create reports and graphs

There are many ways to generate reports in Google Sheets. Become an expert data analyst. Use Google spreadsheet. Reporting tools Become an expert data analyst. Using the Google Spreadsheet reporting tool. Actually Google spreadsheet? The reason for this isn't just because you can do just about anything you want... Read More

Pivot Tables in Google Sheets

Pivot tables are extremely useful if you're looking to calculate the totals of multiple items in your spreadsheet. You can use a pivot table to understand large amounts of data and summarize it in a short digest report. Since it's based on spreadsheet data, you can use conditional formatting, charts, and graphs to visualize the data as well.

For example, if you're using a Google Sheet for your spending habits, you can use a pivot table to calculate the totals. This is a great way to really control how much you spend at Starbucks.

  1. After clicking Record , go Data> Pivot Table .
  2. the Pivot Table Editor it will open in a side panel where you can add the elements you want to appear in your table.
    How to automate repetitive tasks in Google sheets with macros
  3. Under Rows click Add , and select the column that contains the information you want to collect:expense category or location, for example.
  4. Under Values , click Add and select the column that contains the amounts you are spending by category.

This is a very simple example of how a pivot table can be used. How to use an Excel pivot table for data analysis. How to use an Excel pivot table for data analysis. The pivot table is one of the most powerful tools in the Excel 2013 repertoire. It is frequently used for big data analysis. Follow our step-by-step demo to learn all about it. Read more . There are much more elaborate uses, where macros will make your life in Google Sheets easier.

Charts and Pie Charts in Google Sheets

Instead of scrolling through row after row of data, you can also summarize all that information visually.

How to automate repetitive tasks in Google sheets with macros

Again, if you have multiple sheets with similar data, you can create the same chart on multiple different sheets.

For example, if you're tracking your monthly sales, you could create a pie chart that breaks down sales by product.

  • Select the column(s) / row(s) that contain the data you want to display.
  • After clicking the Record button, go to Insert> Chart .
  • In the panel that opens, select the type of chart (line chart, bar chart, pie chart, etc.)

Run that macro on other sheets with similar data for quick visualizations. Google Sheets will also make suggestions for the most suitable chart based on the data.

Example 3:Execute complex functions with macros

This is probably one of the most useful and powerful ways to use macros in Google Sheets, but while complex functions can be complicated, they are made simpler with macros.

There are many existing functions, such as the COUNTIF formula or lookup functions. You can also go one step further and create your own Google Sheets functions How to Create Custom Functions in Google Sheets How to Create Custom Functions in Google Sheets With Google Scripts you can go outside the spreadsheet cell and code your own custom functions. Is easier than it looks like. We will guide you through the process. Read more.

Once you've figured out your function, simply record your macro by running the steps.

Example 4:Make your data easier to see

How to automate repetitive tasks in Google sheets with macros

If you have a lot of data stored in a Google Spreadsheet, it helps to freeze the first row and first column.

That way, when you're looking at a spreadsheet full of numbers or information, keeping the first row or column in view is essential if you want context for what you're looking for.

  1. After clicking the Record button, go to View>Freeze>One Row and View> Freeze> One Column .
  2. Click Save .
  3. Enter a name for the macro and click Save again.

Start a macro and stop the repetitive work

Due to the collaborative nature of Google Sheets, you can run macros while other people continue to enter their information, and you no longer have to download sheets and open them in another program to run a macro.

If collaboration and cloud storage are not a priority for you, you can always opt for Microsoft Excel to record macros How to Record a Macro in Excel 2016 How to Record a Macro in Excel 2016 Did you know you could automate repetitive tasks in Microsoft? Excel using macros? We will show you how to record a macro in Excel 2016 to save a lot of time. Read more .s