{"id":254707,"date":"2017-11-29T15:00:28","date_gmt":"2017-11-29T14:00:28","guid":{"rendered":"https:\/\/blog.sheetgo.com\/?p=7434"},"modified":"2026-10-15T16:02:38","modified_gmt":"2026-10-15T14:02:38","slug":"como-nomear-intervalos-ou-celulas","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/pt\/blog\/google-sheets-features\/create-macros-in-google-sheets\/","title":{"rendered":"Macros do Google Sheets: como ativar, criar e usar"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; da_is_popup=&#8221;off&#8221; da_exit_intent=&#8221;off&#8221; da_has_close=&#8221;on&#8221; da_alt_close=&#8221;off&#8221; da_dark_close=&#8221;off&#8221; da_not_modal=&#8221;on&#8221; da_is_singular=&#8221;off&#8221; da_with_loader=&#8221;off&#8221; da_has_shadow=&#8221;on&#8221; da_disable_devices=&#8221;off|off|off&#8221;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Google Sheets macros let you record a routine task once, such as formatting a table or tidying up a report, and replay it with a click or a keyboard shortcut. You don&#8217;t need to write code to record one, and every macro is saved as Google Apps Script, so you can edit it later.<\/p>\n<p>This guide explains what macros are, why Google Sheets has no setting to enable them, and how to record, run, edit, and import your own. It ends with two examples you can copy.<\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;what-are-google-sheets-macros&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>What are Google Sheets macros?<\/h2>\n<p>Macros are small programs that you can create within Google Sheets. Since you don\u2019t need to use code, it\u2019s become a highly valuable feature to automate repetitive tasks, regardless of the user level. For example, if a regular task in your day-to-day is to format tables following a specific process, you can record this process with the macro recorder (see the last section in this article for more detailed examples).<\/p>\n<p>There\u2019s an obvious advantage \u2013 apart from saving you tons of manual work \u2013 and it\u2019s that Google Sheets macros can help you focus on higher-value tasks for your business. For example, you can use macros to automate advanced analysis or develop complex formulas. By recording tasks such as filtering or formatting data input, you\u2019ll also be able to deliver more accurate and consistent information.<\/p>\n<p>The macro recorder is a Google Sheets feature. Google Docs and Google Slides don&#8217;t have one, so automating them means writing Apps Script yourself.<\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;how-to-enable-macros-in-google-sheets&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>How to enable macros in Google Sheets<\/h2>\n<p>Google Sheets has no setting to enable macros. In Excel, security settings can block macros until you allow them, but in Google Sheets they work by default. The only thing you approve is a one-time authorization: the first time you run a macro, Google asks for permission to let its Apps Script code work with your spreadsheet. Steps 6 to 8 in the next section show those prompts.<\/p>\n<p>Say a colleague has shared a spreadsheet with a recorded macro that speeds up table formatting. This is how to find and run it.<\/p>\n<p><strong>1.<\/strong> Open the Google Sheets containing the recorded macro and head over to Extensions &gt; Macros.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-extensions-menu.webp&#8221; alt=&#8221;Google Sheets macros \u2014 Extensions menu open with Record macro, Import macro, and Manage macros&#8221; title_text=&#8221;Extensions menu open with Record macro, Import macro, and Manage macros&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>2.<\/strong> You should see a list of macros. To run one, click on it.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/run-google-sheets-macro-recorded-list.webp&#8221; alt=&#8221;Run a Google Sheets macro \u2014 recorded Sort by Last Name macro in the Macros submenu&#8221; title_text=&#8221;Recorded Sort by Last Name macro in the Macros submenu&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>Tip:<\/strong> If the macro has a shortcut number, you can also run it by pressing Ctrl + Alt + Shift and that number, for example Ctrl + Alt + Shift + 1. Our <a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-features\/google-sheets-keyboard-shortcuts-guide\/\">Google Sheets keyboard shortcuts guide<\/a> lists many more.<\/p>\n<p>If you don&#8217;t see a list of macros, the spreadsheet has no recorded macros yet. Let\u2019s see how you can record your own macro in a few simple steps.<\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;how-to-create-macros-in-google-sheets&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>How to create macros in Google Sheets<\/h2>\n<p><strong>1.<\/strong> Open a new Google Sheet and head over to Extensions &gt; Macros &gt; Record macro.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/create-google-sheets-macros-record-macro.webp&#8221; alt=&#8221;Create macros in Google Sheets \u2014 Record macro in the Macros submenu of Extensions&#8221; title_text=&#8221;Record macro in the Macros submenu of Extensions&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>Tip:<\/strong> To create a Google Sheet without going into your Drive, type \u201csheets.new\u201d into your browser. If you are in your Drive, you can press Shift + s.<\/p>\n<p><strong>2.<\/strong> In the box below, you\u2019ll see two options: \u201cUse absolute references\u201d or \u201cUse relative references\u201d. If you intend to repeat the same calculation across multiple rows or columns, select the \u201cUse relative references\u201d option.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/record-google-sheets-macro-relative-references.webp&#8221; alt=&#8221;Record a Google Sheets macro \u2014 recording panel with Use relative references selected&#8221; title_text=&#8221;Recording panel with Use relative references selected&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>Tip:<\/strong> Use absolute references if you want to apply the macro to new sets of data that have the same range location every time you run it. Relative references are more commonly used when you need to apply formulas to cells. Take into account that the macro will apply to the cell where your cursor is at that moment.<\/p>\n<p><strong>3.<\/strong> The macro recorder will show every action you take. Once you\u2019ve finished your task, click \u201cSave\u201d.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/record-google-sheets-macro-save-recording.webp&#8221; alt=&#8221;Record a Google Sheets macro \u2014 Save button in the Recording new macro panel&#8221; title_text=&#8221;Save button in the Recording new macro panel&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>4.<\/strong> In the \u201cSave new macro\u201d dialog box, provide a name. Optionally, you can enter a number from 0-9 to create your own shortcut to run that macro. Click \u201cSave\u201d to finish.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-name-and-shortcut.webp&#8221; alt=&#8221;Google Sheets macros \u2014 Save new macro dialog with a name and a Ctrl + Alt + Shift + 1 shortcut&#8221; title_text=&#8221;Save new macro dialog with a name and a Ctrl + Alt + Shift + 1 shortcut&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>5.<\/strong> Head over to Extensions &gt; Macros. To run the macro, click on it.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/run-google-sheets-macro-from-menu.webp&#8221; alt=&#8221;Run a Google Sheets macro \u2014 Sort by Last Name macro with its shortcut in the Macros submenu&#8221; title_text=&#8221;Sort by Last Name macro with its shortcut in the Macros submenu&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>6.<\/strong> The first time you run a macro, Google Sheets asks for permission. Click &#8220;Continue&#8221;.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-authorization-required.webp&#8221; alt=&#8221;Enable macros in Google Sheets \u2014 Authorization Required dialog with the Continue button&#8221; title_text=&#8221;Authorization Required dialog with the Continue button&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>7.<\/strong> Select the Google account you\u2019d like to run this macro on.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-choose-account.webp&#8221; alt=&#8221;Enable macros in Google Sheets \u2014 Choose an account window for the recorded macro&#8221; title_text=&#8221;Choose an account window for the recorded macro&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>8.<\/strong> Click on \u201cAllow\u201d to confirm that you trust the recorded macro.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-allow-access.webp&#8221; alt=&#8221;Enable macros in Google Sheets \u2014 Allow button to let the macro view and manage spreadsheets&#8221; title_text=&#8221;Allow button to let the macro view and manage spreadsheets&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text module_id=&#8221;how-to-edit-rename-or-delete-a-macro&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>How to edit, rename, or delete a macro<\/h2>\n<p>Every macro you record is saved as a function in the spreadsheet&#8217;s Apps Script project. To manage your macros, go to Extensions &gt; Macros &gt; Manage macros. There you can rename a macro or change its shortcut number. Click the three-dot menu next to a macro and choose Edit script to open its code in Apps Script, or Remove to delete it from the Macros menu.<\/p>\n<p>Removing a macro doesn&#8217;t delete its code. The function stays in the Apps Script project until you delete it there too.<\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;how-to-use-macros-in-google-sheets-examp&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>How to use macros in Google Sheets: examples<\/h2>\n<p>So far, we\u2019ve shown basic examples to illustrate how to enable and create Google Sheets macros. You can also build macros from code with <a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-features\/use-google-apps-script-in-google-sheets\/\">Google Apps Script<\/a>, the Google Sheets equivalent of Visual Basic for Applications (VBA) in Excel. Don\u2019t worry! There are ready-made codes for repeatable tasks, so you still don\u2019t need to learn a single line of code.<\/p>\n<h3>Example 1: sort all your sheets alphabetically<\/h3>\n<p>If your spreadsheet has many named tabs, this code puts them in alphabetical order. For more ways to handle tabs, see how to <a href=\"https:\/\/www.sheetgo.com\/blog\/spreadsheets-tips\/work-with-multiple-sheets\/\">work with multiple sheets<\/a>.<\/p>\n<p><strong>1.<\/strong> Open Google Sheets and go to Extensions &gt; Apps Script.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-apps-script-menu.webp&#8221; alt=&#8221;Google Sheets macros with Apps Script \u2014 Apps Script in the Extensions menu&#8221; title_text=&#8221;Apps Script in the Extensions menu&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>2.<\/strong> A new tab will open in your browser. Copy and paste the following code onto a new line:<\/p>\n<pre><code>\/\/ sort sheets alphabetically\nfunction sortSheets() {\n  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();\n  var sheets = spreadsheet.getSheets();\n  var sheetNames = [];\n  sheets.forEach(function(sheet, i) {\n    sheetNames.push(sheet.getName());\n  });\n  sheetNames.sort().forEach(function(sheet, i) {\n    spreadsheet.getSheetByName(sheet).activate();\n    spreadsheet.moveActiveSheet(i + 1);\n  });\n}<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-sort-sheets-code.webp&#8221; alt=&#8221;Google Sheets macros with Apps Script \u2014 sortSheets function pasted in the editor&#8221; title_text=&#8221;SortSheets function pasted in the editor&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>3.<\/strong> Don\u2019t forget to save the script by clicking on the disk icon, as shown below.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-save-script.webp&#8221; alt=&#8221;Google Sheets macros with Apps Script \u2014 Save project icon in the editor toolbar&#8221; title_text=&#8221;Save project icon in the editor toolbar&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>4.<\/strong> Back in your spreadsheet, go to Extensions &gt; Macros &gt; Import macro to import this function as a macro.<\/p>\n<p><strong>Tip:<\/strong> If Import macro is greyed out, Google Sheets hasn&#8217;t found a function it can import. Functions already in the Macros menu don&#8217;t count. Save the script, reload the spreadsheet, and try again.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/import-google-sheets-macro-menu.webp&#8221; alt=&#8221;Import a Google Sheets macro \u2014 Import macro in the Macros submenu of Extensions&#8221; title_text=&#8221;Import macro in the Macros submenu of Extensions&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>5.<\/strong> Click on \u201cAdd Function\u201d to add to your list of macros.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/import-google-sheets-macro-add-function.webp&#8221; alt=&#8221;Import a Google Sheets macro \u2014 Import dialog with sortSheets and Add Function&#8221; title_text=&#8221;Import dialog with sortSheets and Add Function&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>6.<\/strong> Go to Extensions &gt; Macros and click on the macro you just imported.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-run-imported-macro.webp&#8221; alt=&#8221;Google Sheets macros example \u2014 imported sortSheets macro in the Macros submenu&#8221; title_text=&#8221;Imported sortSheets macro in the Macros submenu&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>7.<\/strong> Google Sheets will automatically sort your sheets in alphabetical order, as shown below.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-sorted-sheet-tabs.webp&#8221; alt=&#8221;Google Sheets macros example \u2014 sheet tabs sorted as Alkai, Brad, Roberts, Smith&#8221; title_text=&#8221;Sheet tabs sorted as Alkai, Brad, Roberts, Smith&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>That&#8217;s it: you&#8217;ve turned an Apps Script function into a Google Sheets macro.<\/p>\n<h3>Example 2: reset all filters<\/h3>\n<p>Filters are commonly used to visualize and interpret your data better and more clearly. However, not everyone in your team might be interested in your filtering and need to remove these every time you share the data. This macro clears them in one go. If teammates need their own view of the same data, <a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-features\/filter-google-sheets-without-affecting-other-users\/\">filter views<\/a> let each person filter without affecting other users.<\/p>\n<p><strong>1.<\/strong> Open Google Sheets and go to Extensions &gt; Apps Script.<\/p>\n<p><strong>2.<\/strong> A new tab will open in your browser. Copy and paste the following code onto a new line:<\/p>\n<pre><code>\/\/ reset all filters for a data range on current Sheet\nfunction resetFilter() {\n  var sheet = SpreadsheetApp.getActiveSheet();\n  var range = sheet.getDataRange();\n  range.getFilter().remove();\n  range.createFilter();\n}<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2026\/10\/google-sheets-macros-reset-filter-code.webp&#8221; alt=&#8221;Google Sheets macros example \u2014 resetFilter function in the Apps Script editor&#8221; title_text=&#8221;ResetFilter function in the Apps Script editor&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><strong>3.<\/strong> Follow steps 3-6 from the previous example.<\/p>\n<p>Like before, as soon as you run the macro, Google Sheets will automatically reset any filter you created in a matter of seconds.<\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;conclusion&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>Conclusion<\/h2>\n<p>While Excel offers powerful features to automate tasks, including Power Automate or Power Query, Google Sheets macros now also provides powerful automation features. On top of this, <a href=\"https:\/\/developers.google.com\/apps-script\" rel=\"noreferrer noopener\" target=\"_blank\">Google Apps Script<\/a> is the equivalent of VBA in Excel and has unlocked a greater range of tasks that can help you speed up more complex tasks.<\/p>\n<p>You should now know what Google Sheets macros are, why the only thing to enable is a one-time authorization, and how to record and run your own. You should also feel ready to start using Apps Script to create functions and import them to run as Google Sheets macros.<\/p>\n<p>A macro works inside one spreadsheet. When the same data has to move between files, Sheetgo, an AI-powered data automation platform, connects your spreadsheets and keeps them up to date on a schedule. For more ways to save time, read our <a href=\"https:\/\/www.sheetgo.com\/blog\/spreadsheets-tips\/10-tips-tricks-maximize-google-sheets\/\">10 tips and tricks to maximize Google Sheets<\/a>.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Sheets macros let you record a routine task once, such as formatting a table or tidying up a report, and replay it with a click or a keyboard shortcut. You don&#8217;t need to write code to record one, and every macro is saved as Google Apps Script, so you can edit it later.This guide [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":254716,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"on","_et_pb_old_content":"We most commonly use Google Sheets to store data and share it with others. Among other things it also lets us manipulate and analyze data, resulting in accordingly establishing trends etc. For a regular user, the tasks can get repetitive and time-consuming leading to error-prone. With the help of formulas, we can automate things to a great extent. But with macros (Google App Scripts) we can accomplish much more. In this article, we explain how to create macros in Google Sheets.\n<h3>Why create macros in Google Sheets?<\/h3>\nLet us consider an example. A sales manager looks at a sales data sheet that is auto-populated with the latest raw information every day. Before he begins his work for the day, he needs to generate a report from this raw data in a pre-defined format. This task is accomplished with the exact same manual steps, and therefore it is highly repetitive in nature. Fortunately for him, he can automate the process and execute it in a matter of seconds. While previously he was taking much more to achieve the same output.\n\nWe will use an extremely simple example to show how to create macros in Google Sheets. Because an advanced example is beyond the scope of this article. We recommend you going through <a href=\"https:\/\/developers.google.com\/apps-script\/articles\/tutorials\" target=\"_blank\" rel=\"noopener noreferrer\">this link<\/a> to learn the advanced concepts. The program we are going to write, for the purposes of demonstration in this article, does the following:\n<ul>\n \t<li>Inserts a value \"Hello world!\" in the cell A1.<\/li>\n \t<li>Changes the font to 'Calibri'.<\/li>\n \t<li>Changes the font size in cell A1 to 14.<\/li>\n \t<li>Fills the cell A1 with yellow color.<\/li>\n<\/ul>\nIn order for us to get there, we need to navigate to <strong>Tools &gt; Script editor<\/strong>.\n\n<strong>Example<\/strong> <img class=\"aligncenter size-full wp-image-7495\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/macros1.png\" alt=\"Create macros in Google Sheets - Illustration 1\" width=\"755\" height=\"335\">\n\nOn doing that, it will provide us with a workspace where we can write and execute our program in a separate tab. On the <strong>Script editor<\/strong> window, we write the code as shown in the snapshot below. Before we&nbsp;click on the <strong>Run<\/strong> button, we may want to <strong>Save<\/strong> it using the floppy disk icon.\n\n<strong>Example<\/strong> <img class=\"aligncenter wp-image-7498 size-full\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/macros2.png\" alt=\"Create macros in Google Sheets - Illustration 4\" width=\"823\" height=\"271\">\n\nWhen we try to execute this program, it might ask us to authenticate for the very first time. Here's the result after the program finished its execution.\n\n<strong>Example<\/strong> <img class=\"aligncenter size-full wp-image-7499\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/macros3.png\" alt=\"\" width=\"814\" height=\"462\">\n<h4>Conclusion<\/h4>\nThat was a fairly simple example that explains how to create macros in Google Sheets. However, the real-time applications can get very complex that usually simplifies a lot of stuff, which otherwise would have been difficult to achieve.\n<h4>Advantages<\/h4>\nThe Google Apps script is very similar to Office VBA. But in comparison, Google Apps script offers much more benefits than the traditional VBA does.\n<ol>\n \t<li>VBA runs on a client machine. Whereas&nbsp;Google script runs on the cloud taking its reach and scale are much higher and more flexible. One can even build web-based applications using the Google script. But we can't achieve that with VBA, that at the most can integrate with web applications using an API.<\/li>\n \t<li>We can build user interfaces using both VBA and Google script. The former is constrained when it comes to design (we can only build user forms). But with the latter, we can also leverage the technologies such as HTML, CSS, and Javascript.<\/li>\n \t<li>The list of data types in VBA is limited, as it is still relying on a relatively older technology. While Google script is based on Javascript, which is one of the core web technologies. Therefore we can bank upon its object-oriented elements, flexible data structures, and numerous utilities and build upon that.<\/li>\n<\/ol>","_et_gb_content_width":"","footnotes":""},"categories":[37],"tags":[39,28],"class_list":["post-254707","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google-sheets-features","tag-connections-t","tag-spreadsheets"],"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/254707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/comments?post=254707"}],"version-history":[{"count":0,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/254707\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media\/254716"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media?parent=254707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/categories?post=254707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/tags?post=254707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}