Google Sheets를 사용하면 정의한 특정 UI 상호작용 시리즈를 복제하는 매크로를 기록할 수 있습니다. 매크로를 녹화한 후에는 Ctrl+Alt+Shift+Number 형식으로 단축키에 연결할 수 있습니다. 이 바로가기를 사용하면 일반적으로 다른 위치나 다른 데이터에서 정확한 매크로 단계를 다시 빠르게 실행할 수 있습니다.
Google Sheets의 확장 프로그램>매크로 메뉴에서 매크로를 활성화할 수도 있습니다.
매크로를 기록하면 Google Sheets에서 매크로 단계를 복제하는 Apps Script 함수 (매크로 함수)가 자동으로 생성됩니다. 매크로 함수는 시트에 바인딩된 Apps Script 프로젝트의 macros.gs이라는 파일에 추가됩니다. 해당 이름의 시트에 이미 바인딩된 프로젝트 파일이 있는 경우 매크로 함수가 추가됩니다. Google Sheets는 스크립트 프로젝트 매니페스트도 자동으로 업데이트하여 매크로에 할당된 이름과 단축키를 기록합니다.
기록된 모든 매크로는 Apps Script 내에서 완전히 정의되므로 Apps Script 편집기 내에서 직접 수정할 수 있습니다. Apps Script에서 매크로를 처음부터 작성하거나 이미 작성한 함수를 가져와 매크로로 변환할 수도 있습니다.
Apps Script에서 매크로 만들기
Apps Script로 작성된 함수를 가져와 매크로 함수로 사용할 수 있습니다.
가장 쉬운 방법은 Google Sheets 편집기에서 기존 함수를 가져오는 것입니다.
또는 다음 단계에 따라 Apps Script 편집기 내에서 매크로를 만들 수 있습니다.
Google Sheets UI에서 확장 프로그램>Apps Script를 선택하여 Apps Script 편집기에서 시트에 바인딩된 스크립트를 엽니다.
매크로 함수를 작성합니다. 매크로 함수는 인수를 사용하지 않고 값을 반환하지 않아야 합니다.
스크립트 매니페스트를 수정하여 매크로를 만들고 매크로 함수에 연결합니다. 고유한 단축키와 이름을 할당합니다.
스크립트 프로젝트를 저장합니다. 그러면 시트에서 매크로를 사용할 수 있습니다.
시트에서 매크로 함수를 테스트하여 의도한 대로 작동하는지 확인합니다.
매크로 수정
다음과 같이 시트에 연결된 매크로를 수정할 수 있습니다.
Google Sheets UI에서 확장 프로그램>매크로>매크로 관리를 선택합니다.
수정하려는 매크로를 찾아 more_vert > 매크로 수정을 선택합니다. 그러면 매크로 함수가 포함된 프로젝트 파일이 Apps Script 편집기에서 열립니다.
매크로 동작을 변경하려면 매크로 함수를 수정하세요.
스크립트 프로젝트를 저장합니다. 그러면 시트에서 매크로를 사용할 수 있습니다.
시트에서 매크로 함수를 테스트하여 의도한 대로 작동하는지 확인합니다.
함수를 매크로로 가져오기
시트에 이미 스크립트가 바인드되어 있는 경우 스크립트의 함수를 새 매크로로 가져온 다음 단축키를 할당할 수 있습니다. 매니페스트를 수정하고 sheets.macros[] 속성에 다른 요소를 추가하면 됩니다.
또는 다음 단계에 따라 Sheets UI에서 함수를 매크로로 가져오세요.
Google Sheets UI에서 확장 프로그램>매크로>가져오기를 선택합니다.
표시된 목록에서 함수를 선택한 다음 함수 추가를 클릭합니다.
clear을 선택하여 대화상자를 닫습니다.
확장 프로그램>매크로>매크로 관리를 선택합니다.
목록에서 방금 가져온 함수를 찾습니다. 매크로에 고유한 키보드 단축키를 할당합니다. 여기에서 매크로 이름을 변경할 수도 있습니다. 이름은 기본적으로 함수의 이름으로 설정됩니다.
업데이트를 클릭하여 매크로 구성을 저장합니다.
매크로의 매니페스트 구조
다음 매니페스트 파일 예시 스니펫은 Google Sheets 매크로를 정의하는 매니페스트의 섹션을 보여줍니다.
매니페스트의 sheets 섹션은 매크로에 할당된 이름과 단축키, 매크로 함수의 이름을 정의합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eGoogle Sheets macros automate UI interactions, triggered by keyboard shortcuts or the Extensions menu.\u003c/p\u003e\n"],["\u003cp\u003eMacros are Apps Script functions stored in a bound script project, editable within the Apps Script editor.\u003c/p\u003e\n"],["\u003cp\u003eYou can import existing Apps Script functions as macros or create new ones by editing the script manifest.\u003c/p\u003e\n"],["\u003cp\u003eMacros are limited to 10 keyboard shortcuts per sheet and cannot be used outside of bound Google Sheets scripts.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating macros, prioritize lightweight, repetitive tasks and ensure unique keyboard shortcuts for optimal performance.\u003c/p\u003e\n"]]],[],null,["# Google Sheets Macros\n\nGoogle Sheets lets you record\n[macros](https://support.google.com/docs/answer/7665004) that duplicate a\nspecific series of UI interactions that you define. Once you've recorded a\nmacro, you can link it to a keyboard shortcut in the form\n`Ctrl+Alt+Shift+Number`. You can use that shortcut to quickly execute the\nexact macro steps again, typically in a different place or on different data.\nYou can also activate the macro from the Google Sheets **Extensions**\n\\\u003e **Macros** menu.\n\nWhen you record a macro, Google Sheets automatically creates an Apps Script\nfunction (the *macro function* ) that replicates the macro steps. The macro\nfunction is added to an Apps Script project [bound](/apps-script/guides/bound)\nto the sheet, in a file titled `macros.gs`. In the event that there is\nalready a project file bound to the sheet with that name, the macro function\nis appended to it. Google Sheets also automatically updates the script\nproject [manifest](/apps-script/concepts/manifests), recording the name\nand keyboard shortcut assigned to the macro.\n\nSince every recorded macro is defined entirely within Apps Script, you can\nedit them directly within the Apps Script editor. You can even write macros\nfrom scratch in Apps Script, or take functions you've already written and\nturn them into macros.\n\nCreating macros in Apps Script\n------------------------------\n\nYou can take functions written in Apps Script and use them as macro functions.\nThe easiest way to do this is by\n[importing an existing function](#importing_functions_as_macros) from the\nGoogle Sheets editor.\n\nAlternatively, you can create macros within the Apps Script editor by\nfollowing these steps:\n\n1. In the Google Sheets UI, select **Extensions** \\\u003e **Apps Script** to open the script bound to the sheet in the Apps Script editor.\n2. Write the macro function. Macro functions should take no arguments and return no values.\n3. Edit your [script manifest](/apps-script/concepts/manifests#editing_a_manifest) to create the macro and link it to the macro function. Assign it a unique keyboard shortcut and name.\n4. Save the script project. The macro is then available for use in the sheet.\n5. Test the macro function in the sheet to verify that functions as intended.\n\nEditing macros\n--------------\n\nYou can edit macros attached to a sheet by doing the following:\n\n1. In the Google Sheets UI, select **Extensions** \\\u003e **Macros** \\\u003e **Manage macros**.\n2. Find the macro you want to edit and select **more_vert \\\u003e Edit macro**. This opens the Apps Script editor to the project file containing the macro function.\n3. Edit the macro function to change the macro behavior.\n4. Save the script project. The macro is then available for use in the sheet.\n5. Test the macro function in the sheet to verify that functions as intended.\n\nImporting functions as macros\n-----------------------------\n\nIf there is already a script [bound](/apps-script/guides/bound) to a sheet,\nyou can *import* a function in the script as a new macro and then assign it\na keyboard shortcut. You can do this by\n[editing the manifest](/apps-script/concepts/manifests#editing_a_manifest)\nfile and adding another element to the\n[`sheets.macros[]`](#manifest_structure_for_macros) property.\n\nAlternatively, follow these steps to import a function as a macro from the\nSheets UI:\n\n1. In the Google Sheets UI, select **Extensions** \\\u003e **Macros** \\\u003e **Import**.\n2. Select a function from the list presented and then click **Add function**.\n3. Select clear to close the dialog.\n4. Select **Extensions** \\\u003e **Macros** \\\u003e **Manage macros**.\n5. Locate the function you just imported in the list. Assign a unique keyboard shortcut to the macro. You can also change the macro name here; the name defaults to the name of the function.\n6. Click **Update** to save the macro configuration.\n\nManifest structure for macros\n-----------------------------\n\nThe following manifest file example snippet shows the section of a\n[manifest](/apps-script/concepts/manifests) that defines Google Sheets macros.\nThe `sheets` section of the manifest defines the name and keyboard shortcut\nassigned to the macro and the name of the macro function.\n**Note:** Manifests include other components that relate to Apps Script properties. The fields under the `sheets` relate directly to Sheets functionality. This example is just a portion of a full manifest file and is not a fully functional manifest. \n\n {\n ...\n \"sheets\": {\n \"macros\": [{\n \"menuName\": \"QuickRowSum\",\n \"functionName\": \"calculateRowSum\",\n \"defaultShortcut\": \"Ctrl+Alt+Shift+1\"\n }, {\n \"menuName\": \"Headerfy\",\n \"functionName\": \"updateToHeaderStyle\",\n \"defaultShortcut\": \"Ctrl+Alt+Shift+2\"\n }]\n }\n }\n\nSee the [Sheets macro manifest resource](/apps-script/manifest/sheets)\nfor more details on how Sheets macro manifests are constructed.\n\nBest practices\n--------------\n\nWhen creating or managing macros in Apps Script, it is recommended that you\nadhere to the following guidelines.\n\n1. Macros are more performant when they are light-weight. Where possible, limit the number of actions a macro takes.\n2. Macros are best suited for rote operations that need to be repeated frequently with little or no configuration. For other operations, consider using a [custom menu item](/apps-script/guides/menus) instead.\n3. Always remember that macro keyboard shortcuts must be unique, and a given sheet can only have ten macros with shortcuts at any one time. Any additional macros can only be executed from the **Extensions** \\\u003e **Macros** menu.\n4. Macros that make changes to a single cell can be applied to a range of cells by first selecting the full range and then activating the macro. This means it is often unnecessary to create macros that duplicate the same operation across a predefined range of cells.\n\nThings you can't do\n-------------------\n\nThere are a few restrictions on what you can do with macros:\n\n#### Use macros outside bound scripts\n\nMacros are defined in scripts bound to specific Google Sheets. Macro\ndefinitions are ignored if defined in a\n[standalone script](/apps-script/guides/standalone) or\n[web app](/apps-script/guides/web).\n\n#### Define macros in Sheets add-ons\n\nYou cannot distribute macro definitions using a\n[Sheets add-on](/workspace/add-ons/overview). Any macro definitions in a Sheets\nadd-on project are ignored by users of that add-on.\n\n#### Distribute macros in script libraries\n\nYou cannot distribute macro definitions using Apps Script\n[libraries](/apps-script/guides/libraries).\n\n#### Use macros outside of Google Sheets\n\nMacros are only a feature in Google Sheets, and do not exist for Google Docs,\nForms, or Slides."]]