Does Google Sheets have macros? The short answer is YES – you can use macros in Google Sheets.
What is Macro in Google Sheets?
Macro – as a computing term – means – a set of instructions/steps allows you to perform particular tasks.
In simple words, you can create steps in advance, and when you run the macro, these steps will be executed. An example would be deleting a set of rows/columns. As soon as you run the macro, it will go and delete the specified rows/columns in the specified worksheet.
Although macro is a computing term, for people in the spreadsheet word, it mostly means the VBA macros (Visual Basic for Applications) in Excel spreadsheets.
So let me cover the important question first:
Table of Contents
Do Excel Macros Work in Google Sheets?
If you have added an Excel file to Google Drive or have converted an Excel file into a Google Sheets document, the macros in the Excel file WILL NOT work.
While Google Sheets is trying to accommodate a lot of what an existing Excel file can have, there are still some gaps, and they don’t support Excel macros.
Can You Record Macros in Google Sheets?
YES – you can record Google Macros in Google Sheets!
This can easily be done. Just like you record macros in Excel, you can also do that in Google Sheets.
Once you record a macro in Google Sheets, you can go to the Script Editor and have a look at the code and modify it accordingly.
And that brings me to another burning question.
How Can You Use Excel Macros in Google Sheets?
As I have already mentioned that you can not run Excel macros in Google Sheets.
So the options are:
- Take the VBA code that you have in Excel and get it converted to Google Apps Script. If you don’t know GAS, you can hire a developer to get this done (someone who understands Excel and Google Sheets both)
- Record a macro in Google Sheets that closely resembles what the VBA code does. In many cases, this may not be possible (as macro recorder has limitations), but in case it can be done, this will give you a rough version of the Google Apps Script code that you can further refine.
Macro in Google Sheets Vs Excel Macros
I am not an expert in programming, but I do have (limited) experience with coding Excel macros in VBA and some in Google App Script.
Here are my thoughts (consider these as first impressions from a newbie):
- I find writing and learning VBA macros a bit easier (as compared with Google App Script). I think that’s universally true and VBA is easier than Java.
- There is a lot of help and documentation available for Excel VBA, but not enough for Google Sheets macros.
- While you can use Excel VBA to work with other applications, it’s not great with it. Google Apps Script excels in this area (pun intended!). You can use it to open and extract data from websites or work with other web-applications.
Does Google Sheets Have VBA/ What Language Does Google Sheets Use for Macros?
How Do I Create a Macro Button in Google Sheets?
To create a new macro, all you have to do is:
- Navigate to Tools > Macros > Record Macro
- Record the actions you want to save as macro
- Save the macro
I hope you found these macros in Google Sheets tips useful!
Other Google Sheets articles you may find useful: