Google Docs 편집기 부가기능 빠른 시작
이 빠른 시작에서는 문서에서 선택한 텍스트를 번역하는 Google Docs 편집기 부가기능을 만듭니다.
목표
- 스크립트를 설정합니다.
- 스크립트를 실행합니다.
기본 요건
이 샘플을 사용하려면 다음 기본 요건이 필요합니다.
- Google 계정 (Google Workspace 계정의 경우 관리자 승인이 필요할 수 있음)
- 인터넷에 액세스할 수 있는 웹브라우저
스크립트 설정
- docs.new에서 Google Docs 문서를 만듭니다.
- 확장 프로그램 > Apps Script를 클릭합니다.
- 제목 없는 프로젝트를 클릭합니다.
- Apps Script 프로젝트 Translate Docs의 이름을 바꾸고 이름 바꾸기를 클릭합니다.
Code.gs
파일 옆에 있는 더보기 more_vert
> 이름 바꾸기를 클릭합니다. 파일 이름을 translate
로 지정합니다.
- 파일 추가 add
> HTML을 클릭합니다. 파일 이름을
sidebar
로 지정합니다.
각 파일의 콘텐츠를 다음과 같은 해당 코드로 바꾸고
저장을 클릭합니다.
스크립트 실행
- Docs 문서에서 페이지를 새로고침합니다.
- 확장 프로그램 >
Docs 번역
> 시작을 클릭합니다.
- 메시지가 표시되면 부가기능을 승인합니다.
승인되면 부가기능이 다시 시작됩니다.
- 문서에 텍스트를 입력하고 선택합니다.
- 부가기능에서 번역을 클릭합니다. 문서의 텍스트를 바꾸려면 삽입을 클릭합니다.
다음 단계
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-02-14(UTC)
[null,null,["최종 업데이트: 2025-02-14(UTC)"],[[["This quickstart guide demonstrates how to build a Google Docs add-on using Apps Script that translates selected text within a document."],["The add-on allows users to select text, choose source and target languages, and obtain the translation, with an option to insert the translated text directly into the document."],["Users need a Google Account and a web browser to utilize this add-on, which involves setting up a script, running it, and authorizing permissions."],["The add-on provides a user interface within a sidebar in Google Docs for easy interaction and language selection."],["Further resources are available for extending Google Docs functionality with Apps Script and exploring the Document service for more advanced customizations."]]],["This document guides the creation of a Google Docs add-on for text translation. It involves creating a new Google Docs file and an Apps Script project. You will rename files to `translate` and `sidebar`, and replace their content with provided code. The code defines functions for opening a sidebar, selecting text, translating it, and inserting the translated text back into the document. After reloading, accessing the add-on requires selecting text, choosing languages, clicking 'Translate', and finally, clicking 'Insert'.\n"]]