스크립트가 독립형 스크립트이 아닌 해당 문서에서 생성된 경우 Google Sheets, Docs, Slides 또는 Forms 파일에 바인딩됩니다. 바인드된 스크립트가 연결된 파일을 '컨테이너'라고 합니다. 바인드된 스크립트는 일반적으로 독립형 스크립트와 유사하게 작동하지만 Google Drive에 표시되지 않고 바인드된 파일에서 분리할 수 없으며 상위 파일에 대한 몇 가지 특별한 권한을 얻습니다.
스크립트는 Google 사이트 도구에 바인드될 수도 있지만 이러한 스크립트는 거의 항상 웹 앱으로 배포됩니다. Google Sheets, Docs, Slides 또는 Forms에 바인딩된 스크립트도 웹 앱이 될 수 있지만 흔한 경우는 아닙니다.
바인드된 스크립트 만들기
Google Docs, Sheets, Slides
Google Docs, Sheets 또는 Slides에서 바운드 스크립트를 만들려면 Docs에서 문서를 열고, Sheets에서 스프레드시트를 열고, Slides에서 프레젠테이션을 연 다음 확장 프로그램>Apps Script를 클릭합니다. 나중에 스크립트를 다시 열려면 동일한 작업을 수행하거나 Apps Script 대시보드에서 스크립트를 엽니다.
Google Forms
Google Forms에서 바인드된 스크립트를 만들려면 양식을 열고 더보기 more_vert>스크립트 편집기를 클릭합니다. 나중에 스크립트를 다시 열려면 동일한 작업을 수행하거나 Apps Script 대시보드에서 스크립트를 엽니다.
특수 메서드
바인드된 스크립트는 독립형 스크립트가 호출할 수 없는 몇 가지 메서드를 호출할 수 있습니다.
바운드 스크립트는 맞춤 메뉴와 대화상자 또는 사이드바를 추가하여 Google Sheets, Docs, Forms를 맞춤설정할 수 있습니다. 하지만 스크립트는 열린 파일의 현재 인스턴스에 대한 사용자 인터페이스와만 상호작용할 수 있습니다. 즉, 한 문서에 바인드된 스크립트는 다른 문서의 사용자 인터페이스에 영향을 줄 수 없습니다.
트리거
바인드된 스크립트는 수정 액세스 권한이 있는 사용자가 파일을 열 때마다 자동으로 실행되는 특수 onOpen() 함수와 같은 단순 트리거를 사용할 수 있습니다. 모든 유형의 스크립트와 마찬가지로 설치 가능한 트리거도 사용할 수 있습니다.
커스텀 함수
맞춤 함수는 Google Sheets에 바인딩된 스크립트의 함수로, =myFunctionName() 문법을 사용하여 셀에서 직접 호출합니다. 따라서 맞춤 함수는 AVERAGE 또는 SUM와 같은 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-04(UTC)"],[[["\u003cp\u003eBound scripts are Google Apps Scripts attached to Google Docs, Sheets, Slides, or Forms, offering special privileges to interact with their parent file.\u003c/p\u003e\n"],["\u003cp\u003eUnlike standalone scripts, bound scripts reside within their container file and cannot be detached, functioning like unpublished add-ons specific to that file.\u003c/p\u003e\n"],["\u003cp\u003eThey allow the use of special methods to programmatically access and manipulate the parent file's content and user interface.\u003c/p\u003e\n"],["\u003cp\u003eBound scripts can be shared by sharing the container file, enabling collaborators with edit access to run the script.\u003c/p\u003e\n"],["\u003cp\u003eThese scripts can also be published as add-ons, making them accessible to a wider audience through the add-on store.\u003c/p\u003e\n"]]],[],null,["A script is bound to a Google Sheets, Docs, Slides, or Forms file if it was\ncreated from that document rather than as a [standalone script](/apps-script/guides/standalone).\nThe file that a bound script is attached to is called a \"container.\"\nBound scripts generally behave like standalone scripts except that they\ndo not appear in Google Drive, they cannot be detached from the file\nthey are bound to, and they gain a few special privileges over the parent file.\n\nNote that scripts can also be bound to Google Sites, but these scripts are\nalmost always deployed as [web apps](/apps-script/guides/web). Scripts\nbound to Google Sheets, Docs, Slides, or Forms can also become web apps, although\nthis is uncommon.\n| **Note:** Bound scripts are effectively unpublished [add-ons](/workspace/add-ons/concepts/types#editor_add-ons) that function only for the file they are bound to.\n\nCreate a bound script\n\nGoogle Docs, Sheets, or Slides\n\nTo create a bound script in Google Docs, Sheets, or Slides, open a document in\nDocs, a spreadsheet in Sheets, or a presentation in Slides and click\n**Extensions**\n\\\u003e **Apps Script** . To reopen the script in\nthe future, do the same thing or open the script from the\n[Apps Script dashboard](https://script.google.com/home).\n\nGoogle Forms\n\nTo create a bound script in Google Forms, open a form\nand click More more_vert\n\\\u003e **Script\neditor** . To reopen the script in the\nfuture, do the same thing or open the script from the\n[Apps Script dashboard](https://script.google.com/home).\n| **Note:** The [`clasp`](/apps-script/guides/clasp) tool can't create bound scripts, but it can clone and edit them.\n\nSpecial methods\n\nBound scripts can call a few methods that standalone scripts cannot:\n\n- [`getActiveSpreadsheet()`](/apps-script/reference/spreadsheet/spreadsheet-app#getActiveSpreadsheet()), [`getActiveDocument()`](/apps-script/reference/document/document-app#getActiveDocument()), [`getActivePresentation()`](/apps-script/reference/slides/slides-app#getactivepresentation), and [`getActiveForm()`](/apps-script/reference/forms/form-app#getActiveForm()) allow bound scripts to refer to their parent file without referring to the file's ID.\n- [`getUi`](/apps-script/reference/spreadsheet/spreadsheet-app#getUi()) lets bound scripts access the user interface for their parent file to add [custom menus, dialogs, and sidebars](#custom_menus_dialogs_and_sidebars).\n- In Google Sheets, [`getActiveSheet()`](/apps-script/reference/spreadsheet/spreadsheet-app#getActiveSheet()), [`getActiveRange()`](/apps-script/reference/spreadsheet/spreadsheet-app#getActiveRange()), and [`getActiveCell()`](/apps-script/reference/spreadsheet/sheet#getActiveCell()) let the script determine the user's current sheet, selected range of cells, or selected individual cell. [`setActiveSheet(sheet)`](/apps-script/reference/spreadsheet/spreadsheet-app#setActiveSheet(Sheet)) and [`setActiveRange(range)`](/apps-script/reference/spreadsheet/spreadsheet-app#setActiveRange(Range)) let the script change those selections.\n- In Google Docs, [`getActiveTab()`](/apps-script/reference/document/document#getActiveTab()), [`getCursor()`](/apps-script/reference/document/document#getCursor()), and [`getSelection()`](/apps-script/reference/document/document#getSelection()) let the script determine the user's current tab, position of the user's cursor, or selected text. [`setActiveTab(tabId)`](/apps-script/reference/document/document#setActiveTab(String)), [`setCursor(position)`](/apps-script/reference/document/document#setCursor(Position)) and [`setSelection(range)`](/apps-script/reference/document/document#setSelection(Range)) let the script change those selections.\n\nFor more information, see the\n[guide to extending Google Sheets](/apps-script/guides/sheets) or\nthe [guide to extending Google Docs](/apps-script/guides/docs).\n| **Note:** These methods are only available to bound scripts run from the script editor, menu items, dialogs, sidebars, or triggers. When a bound script is run as a web app or via the [Apps Script API](/apps-script/api/how-tos/execute), these methods are not available.\n\nCustom menus, dialogs, and sidebars\n\nBound scripts can customize Google Sheets, Docs, and Forms by adding\n[custom menus](/apps-script/guides/menus) and\n[dialog boxes or sidebars](/apps-script/guides/dialogs). Keep in mind,\nhowever, that a script can only interact with the user interface for the\ncurrent instance of an open file. That is, a script bound to one document\ncannot affect the user interface of another document.\n| Add-ons can also add custom menus, dialogs and sidebars. It is recommended to develop add-ons using [standalone scripts](/apps-script/guides/standalone).\n\nTriggers\n\nBound scripts can use [simple triggers](/apps-script/guides/triggers)\nlike the special `onOpen()` function, which runs automatically whenever a file\nis opened by a user who has edit access. Like all types of scripts, they can\nalso use [installable triggers](/apps-script/guides/triggers/installable).\n\nCustom functions\n\nA [custom function](/apps-script/guides/sheets/functions) is a function in a\nscript bound to Google Sheets that you call directly from a cell using the\nsyntax `=myFunctionName()`. Custom functions are thus similar to the hundreds of\n[built-in functions](https://support.google.com/drive/topic/1361471) in Sheets\nlike [`AVERAGE`](https://support.google.com/drive/answer/3093615) or\n[`SUM`](https://support.google.com/drive/answer/3093669) except that you define\nthe custom function's behavior.\n\nAccess to bound scripts\n\nOnly users who have permission to edit a container can run its bound script.\nCollaborators who have only view access can't open the script\neditor, although if they make a copy of the container file, they become the\nowner of the copy and can see and run a copy of the script.\n\nTo learn how to share a script's container file, refer to [Share files from\nGoogle Drive](https://support.google.com/drive/answer/2494822).\n| All container-bound scripts use the same owner, viewer, and editor access list defined for the container file. The container owner takes ownership of a new script project regardless of who created it."]]