Google Sheets 파일에 액세스하고 수정합니다. 일반적인 작업은 새 시트를 추가하고 공동작업자를 추가하는 것입니다.
방법
자세한 문서
addDeveloperMetadata(key)
지정된 키가 있는 개발자 메타데이터를 최상위 스프레드시트에 추가합니다.
// Opens the spreadsheet file by its URL. If you created your script from within a // Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead. // TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit'); // Adds the key 'NAME' in the developer metadata for the spreadsheet. ss.addDeveloperMetadata('NAME') // Gets the first developer metadata object and logs its key. const developerMetaData = ss.getDeveloperMetadata()[0] console.log(developerMetaData.getKey())
매개변수
이름 | 유형 | 설명 |
---|---|---|
key | String | 새 개발자 메타데이터의 키입니다. |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addDeveloperMetadata(key, visibility)
지정된 키와 공개 상태가 포함된 개발자 메타데이터를 스프레드시트에 추가합니다.
// Opens the spreadsheet file by its URL. If you created your script from within a // Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead. // TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit'); // Adds the key 'NAME' in the developer metadata for the spreadsheet and sets the visibility // to the developer project that created the metadata. ss.addDeveloperMetadata('NAME', SpreadsheetApp.DeveloperMetadataVisibility.PROJECT); // Gets the first developer metadata object and logs its key and visibility setting. const developerMetaData = ss.getDeveloperMetadata()[0]; console.log(developerMetaData.getKey()); console.log(`Key: ${developerMetaData.getKey()}, . Visibility: ${developerMetaData.getVisibility()}`);
매개변수
이름 | 유형 | 설명 |
---|---|---|
key | String | 새 개발자 메타데이터의 키입니다. |
visibility | DeveloperMetadataVisibility | 새 개발자 메타데이터의 공개 상태입니다. |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addDeveloperMetadata(key, value)
지정된 키와 값이 있는 개발자 메타데이터를 스프레드시트에 추가합니다.
// Opens the spreadsheet file by its URL. If you created your script from within a // Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead. // TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit'); // Adds the key 'NAME' and sets the value to 'GOOGLE' in the developer metadata for the // spreadsheet. ss.addDeveloperMetadata('NAME', 'GOOGLE'); // Gets the first developer metadata object and logs its key and value. const developerMetaData = ss.getDeveloperMetadata()[0]; console.log(developerMetaData.getKey()); console.log(`Key: ${developerMetaData.getKey()}, Value: ${developerMetaData.getValue()}`);
매개변수
이름 | 유형 | 설명 |
---|---|---|
key | String | 새 개발자 메타데이터의 키입니다. |
value | String | 새 개발자 메타데이터 값입니다. |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addDeveloperMetadata(key, value, visibility)
지정된 키, 값, 공개 상태가 포함된 개발자 메타데이터를 스프레드시트에 추가합니다.
// Opens the spreadsheet file by its URL. If you created your script from within a // Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead. // TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit'); // Adds the key 'NAME', sets the value to 'GOOGLE', and sets the visibility // to any developer project with document access. ss.addDeveloperMetadata('NAME', 'GOOGLE', SpreadsheetApp.DeveloperMetadataVisibility.DOCUMENT); // Gets the first developer metadata object and logs its key, value, and visibility setting. const developerMetaData = ss.getDeveloperMetadata()[0]; console.log(`Key: ${developerMetaData.getKey()}, Value: ${developerMetaData.getValue()}, Visibility: ${developerMetaData.getVisibility()}`);
매개변수
이름 | 유형 | 설명 |
---|---|---|
key | String | 새 개발자 메타데이터의 키입니다. |
value | String | 새 개발자 메타데이터 값입니다. |
visibility | DeveloperMetadataVisibility | 새 개발자 메타데이터의 공개 상태입니다. |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addEditor(emailAddress)
지정된 사용자를 Spreadsheet
의 편집자 목록에 추가합니다. 사용자가 이미 뷰어 목록에 있는 경우 이 방법은 뷰어 목록에서 사용자를 승격합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
emailAddress | String | 추가할 사용자의 이메일 주소입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addEditor(user)
지정된 사용자를 Spreadsheet
의 편집자 목록에 추가합니다. 사용자가 이미 뷰어 목록에 있는 경우 이 방법은 뷰어 목록에서 사용자를 승격합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
user | User | 추가할 사용자의 표현입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addEditors(emailAddresses)
지정된 사용자 배열을 Spreadsheet
의 편집기 목록에 추가합니다. 이미 뷰어 목록에 있는 사용자가 있는 경우 이 메서드는 뷰어 목록에서 사용자를 승격시킵니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
emailAddresses | String[] | 추가할 사용자의 이메일 주소 배열입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addMenu(name, subMenus)
스프레드시트 UI에 새 메뉴를 만듭니다.
각 메뉴 항목은 사용자 정의 함수를 실행합니다. 일반적으로 스프레드시트가 로드될 때 메뉴가 자동으로 생성되도록 onOpen()
함수에서 이 메서드를 호출하는 것이 좋습니다.
// The onOpen function is executed automatically every time a Spreadsheet is loaded function onOpen() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var menuEntries = []; // When the user clicks on "addMenuExample" then "Menu Entry 1", the function function1 is // executed. menuEntries.push({name: "Menu Entry 1", functionName: "function1"}); menuEntries.push(null); // line separator menuEntries.push({name: "Menu Entry 2", functionName: "function2"}); ss.addMenu("addMenuExample", menuEntries); }
매개변수
이름 | 유형 | 설명 |
---|---|---|
name | String | 만들 메뉴의 이름입니다. |
subMenus | Object[] | name 및 functionName
매개변수가 포함된 자바스크립트 맵의 배열입니다. 포함된 라이브러리의 함수(예:
Library.libFunction1 )를 사용할 수 있습니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addViewer(emailAddress)
지정된 사용자를 Spreadsheet
의 뷰어 목록에 추가합니다. 사용자가 이미 편집자 목록에 있는 경우 이 메서드는 영향을 미치지 않습니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
emailAddress | String | 추가할 사용자의 이메일 주소입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addViewer(user)
지정된 사용자를 Spreadsheet
의 뷰어 목록에 추가합니다. 사용자가 이미 편집자 목록에 있는 경우 이 메서드는 영향을 미치지 않습니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
user | User | 추가할 사용자의 표현입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
addViewers(emailAddresses)
지정된 사용자 배열을 Spreadsheet
의 뷰어 목록에 추가합니다. 이미 편집자 목록에 있는 사용자가 있는 경우 이 방법은 사용자에게 영향을 미치지 않습니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
emailAddresses | String[] | 추가할 사용자의 이메일 주소 배열입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
appendRow(rowContents)
시트의 현재 데이터 리전 하단에 행을 추가합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Appends a new row with 3 columns to the bottom of the current // data region in the sheet containing the values in the array. sheet.appendRow(["a man", "a plan", "panama"]);
매개변수
이름 | 유형 | 설명 |
---|---|---|
rowContents | Object[] | 시트의 마지막 행 뒤에 삽입할 값의 배열입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
autoResizeColumn(columnPosition)
지정된 열의 너비를 내용에 맞게 설정합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; sheet.getRange('a1').setValue('Whenever it is a damp, drizzly November in my soul...'); // Sets the first column to a width which fits the text sheet.autoResizeColumn(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
columnPosition | Integer | 크기를 조절할 특정 열의 위치입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
copy(name)
스프레드시트를 복사하고 새 스프레드시트를 반환합니다.
// This code makes a copy of the current spreadsheet and names it appropriately var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.copy("Copy of " + ss.getName());
매개변수
이름 | 유형 | 설명 |
---|---|---|
name | String | 사본의 이름입니다. |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
createDeveloperMetadataFinder()
이 스프레드시트의 범위 내에서 개발자 메타데이터를 찾기 위한 DeveloperMetadataFinder
를 반환합니다. 기본적으로 스프레드시트, 시트, 행, 열과 관련된 모든 메타데이터를 고려합니다.
// Opens the spreadsheet file by its URL. If you created your script from within a // Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead. // TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit'); // Adds developer metadata to the spreadsheet. ss.addDeveloperMetadata('NAME', 'CHARLIE'); ss.addDeveloperMetadata('COMPANY', 'EXAMPLE ORGANIZATION'); ss.addDeveloperMetadata('TECHNOLOGY', 'JAVASCRIPT'); // Creates a developer metadata finder. const developerMetadataFinder = ss.createDeveloperMetadataFinder(); // Finds the developer metadata objects with 'COMPANY' as the key. const googleMetadataFromSpreadsheet = developerMetadataFinder.withKey('COMPANY').find(); // Gets the first result of developer metadata that has the key 'COMPANY' and logs its value. console.log(googleMetadataFromSpreadsheet[0].getValue());
리턴
DeveloperMetadataFinder
— 이 스프레드시트 범위에서 메타데이터를 검색하는 개발자 메타데이터 파인더입니다.
createTextFinder(findText)
스프레드시트 내에 있는 텍스트를 찾아 바꾸는 데 사용할 수 있는 스프레드시트용 텍스트 찾기를 만듭니다. 검색은 스프레드시트의 첫 번째 시트에서 시작됩니다.
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); // Creates a text finder. var textFinder = spreadsheet.createTextFinder('dog'); // Returns the first occurrence of 'dog' in the spreadsheet. var firstOccurrence = textFinder.findNext(); // Replaces the last found occurrence of 'dog' with 'cat' and returns the number // of occurrences replaced. var numOccurrencesReplaced = findOccurrence.replaceWith('cat');
매개변수
이름 | 유형 | 설명 |
---|---|---|
findText | String | 검색할 텍스트입니다. |
리턴
TextFinder
: 스프레드시트의 TextFinder
입니다.
deleteActiveSheet()
현재 활성 시트를 삭제합니다.
// The code below deletes the currently active sheet and stores the new active sheet in a // variable var newSheet = SpreadsheetApp.getActiveSpreadsheet().deleteActiveSheet();
리턴
Sheet
— 새 활성 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
deleteColumn(columnPosition)
지정된 열 위치의 열을 삭제합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Columns start at "1" - this deletes the first column sheet.deleteColumn(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
columnPosition | Integer | 열의 위치로, 첫 번째 열의 경우 1부터 시작합니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
deleteColumns(columnPosition, howMany)
지정된 열 위치에서 시작하는 여러 열을 삭제합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Columns start at "1" - this deletes the first two columns sheet.deleteColumns(1, 2);
매개변수
이름 | 유형 | 설명 |
---|---|---|
columnPosition | Integer | 삭제할 첫 번째 열의 위치입니다. |
howMany | Integer | 삭제할 열의 수입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
deleteRow(rowPosition)
지정된 행 위치의 행을 삭제합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Rows start at "1" - this deletes the first row sheet.deleteRow(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
rowPosition | Integer | 행의 위치로, 첫 번째 행의 경우 1부터 시작합니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
deleteRows(rowPosition, howMany)
지정된 행 위치에서 시작하는 여러 행을 삭제합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Rows start at "1" - this deletes the first two rows sheet.deleteRows(1, 2);
매개변수
이름 | 유형 | 설명 |
---|---|---|
rowPosition | Integer | 삭제할 첫 번째 행의 위치입니다. |
howMany | Integer | 삭제할 행 수입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
deleteSheet(sheet)
지정된 시트를 삭제합니다.
// The code below deletes the specified sheet. var ss = SpreadsheetApp.getActive(); var sheet = ss.getSheetByName('My Sheet'); ss.deleteSheet(sheet);
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheet | Sheet | 삭제할 시트입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
duplicateActiveSheet()
활성 시트를 복제하여 활성 시트로 만듭니다.
// The code below makes a duplicate of the active sheet SpreadsheetApp.getActiveSpreadsheet().duplicateActiveSheet();
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getActiveCell()
이 시트의 활성 셀을 반환합니다.
참고: 현재 강조표시된 셀을 반환하는 getCurrentCell()
를 사용하는 것이 좋습니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Returns the active cell var cell = sheet.getActiveCell();
리턴
Range
— 현재 활성 셀
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getActiveRange()
활성 시트에서 선택된 범위를 반환하거나, 활성 범위가 없는 경우 null
을 반환합니다. 여러 범위를 선택하면 이 메서드는 마지막으로 선택한 범위만 반환합니다.
'활성 범위'라는 용어는 사용자가 활성 시트에서 선택한 범위를 의미하지만 맞춤 함수에서는 적극적으로 다시 계산되는 셀을 나타냅니다.
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var activeRange = sheet.getActiveRange();
리턴
Range
— 활성 범위
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
참고 항목
getActiveRangeList()
활성 시트의 활성 범위 목록 또는 활성 범위가 없는 경우 null
을 반환합니다.
단일 범위를 선택한 경우 getActiveRange()
호출로 작동합니다.
var sheet = SpreadsheetApp.getActiveSheet(); // Returns the list of active ranges. var activeRangeList = sheet.getActiveRangeList();
리턴
RangeList
— 활성 범위 목록
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
참고 항목
getActiveSheet()
스프레드시트의 활성 시트를 가져옵니다.
스프레드시트의 활성 시트는 스프레드시트 UI에 표시되는 시트입니다.
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
리턴
Sheet
: 스프레드시트의 활성 시트입니다.
getAs(contentType)
이 객체 내의 데이터를 지정된 콘텐츠 유형으로 변환된 blob으로 반환합니다. 이 방법은 파일 이름에 적절한 확장자를 추가합니다(예: 'myfile.pdf'). 그러나 마지막 마침표 뒤에 오는 파일 이름 부분이 (존재하는 경우) 대체되어야 하는 기존 확장 프로그램이라고 가정합니다. 따라서 'ShoppingList.12.25.2014'는 'ShoppingList.12.25.pdf'가 됩니다.
전환의 일일 할당량은 Google 서비스 할당량을 참고하세요. 새로 만든 Google Workspace 도메인에는 더 엄격한 할당량이 적용될 수 있습니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
contentType | String | 변환할 MIME 유형입니다. 대부분의 blob에서 'application/pdf' 가 유일한 유효한 옵션입니다. BMP, GIF, JPEG 또는 PNG 형식의 이미지도 'image/bmp' , 'image/gif' , 'image/jpeg' 또는 'image/png' 입니다. |
리턴
Blob
- blob 데이터
getBandings()
getBlob()
getColumnWidth(columnPosition)
지정된 열의 너비를 픽셀 단위로 가져옵니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Columns start at 1 Logger.log(sheet.getColumnWidth(1));
매개변수
이름 | 유형 | 설명 |
---|---|---|
columnPosition | Integer | 검사할 열의 위치입니다. |
리턴
Integer
— 열 너비(픽셀)
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getCurrentCell()
활성 시트의 현재 셀을 반환하거나, 현재 셀이 없는 경우 null
를 반환합니다. 현재 셀은 Google Sheets UI에 포커스가 있는 셀로 어두운 테두리로 강조표시됩니다. 현재 셀은 두 개 이상 없습니다. 사용자가 셀 범위를 하나 이상 선택하면 선택한 셀 중 하나가 현재 셀입니다.
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); // Returns the current highlighted cell in the one of the active ranges. var currentCell = sheet.getCurrentCell();
리턴
Range
— 현재 셀
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataRange()
데이터가 있는 측정기준에 해당하는 Range
를 반환합니다.
A1 및 (Sheet.getLastColumn(), Sheet.getLastRow())로 제한된 범위를 만드는 것과 기능적으로 동일합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This represents ALL the data var range = sheet.getDataRange(); var values = range.getValues(); // This logs the spreadsheet in CSV format with a trailing comma for (var i = 0; i < values.length; i++) { var row = ""; for (var j = 0; j < values[i].length; j++) { if (values[i][j]) { row = row + values[i][j]; } row = row + ","; } Logger.log(row); }
리턴
Range
— 스프레드시트의 모든 데이터로 구성된 범위
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourceFormulas()
모든 데이터 소스 수식을 가져옵니다.
리턴
DataSourceFormula[]
— 데이터 소스 수식 목록입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourcePivotTables()
모든 데이터 소스 피벗 테이블을 가져옵니다.
리턴
DataSourcePivotTable[]
— 데이터 소스 피벗 테이블의 목록입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourceRefreshSchedules()
이 스프레드시트의 새로고침 일정을 가져옵니다.
리턴
DataSourceRefreshSchedule[]
: 이 스프레드시트의 새로고침 일정입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourceSheets()
스프레드시트의 모든 데이터 소스 시트를 반환합니다.
리턴
DataSourceSheet[]
: 모든 데이터 소스 시트의 배열입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSourceTables()
모든 데이터 소스 테이블을 가져옵니다.
리턴
DataSourceTable[]
- 데이터 소스 테이블 목록입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDataSources()
스프레드시트의 모든 데이터 소스를 반환합니다.
리턴
DataSource[]
- 모든 데이터 소스의 배열입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDeveloperMetadata()
최상위 스프레드시트와 연결된 개발자 메타데이터를 가져옵니다.
리턴
DeveloperMetadata[]
- 이 범위와 연결된 개발자 메타데이터입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getEditors()
이 Spreadsheet
의 편집자 목록을 가져옵니다.
리턴
User[]
- 수정 권한이 있는 사용자의 배열입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getFormUrl()
이 스프레드시트로 응답을 보내는 양식의 URL을 반환하거나 스프레드시트에 연결된 양식이 없는 경우 null
을 반환합니다. 여러 양식이 이 스프레드시트로 응답을 보내면 반환되는 양식 URL이 명확하지 않습니다. 또는 Sheet.getFormUrl()
메서드를 통해 시트별 URL 연결을 검색할 수 있습니다.
리턴
String
— 이 스프레드시트에 응답을 배치하는 양식의 URL 또는 이 스프레드시트에 연결된 양식이 없는 경우 null
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getFrozenColumns()
고정된 열 수를 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; Logger.log("Number of frozen columns: %s", sheet.getFrozenColumns());
리턴
Integer
— 고정된 열 수입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getFrozenRows()
고정된 행의 수를 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; Logger.log("Number of frozen rows: %s", sheet.getFrozenRows());
리턴
Integer
— 고정된 행 수
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getId()
이 스프레드시트의 고유 식별자를 가져옵니다. 스프레드시트 ID를 URL에서 추출할 수 있습니다. 예를 들어 URL https://docs.google.com/spreadsheets/d/abc1234567/edit#gid=0의 스프레드시트 ID는 'abc1234567'입니다.
// The code below logs the ID for the active spreadsheet. Logger.log(SpreadsheetApp.getActiveSpreadsheet().getId());
리턴
String
: 스프레드시트의 고유 ID (또는 키)입니다.
getImages()
시트의 모든 격자무늬 이미지를 반환합니다.
리턴
OverGridImage[]
— 오버 그리드 이미지 배열입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getIterativeCalculationConvergenceThreshold()
반복 계산 시 사용되는 임곗값을 반환합니다. 연속 계산 결과가 이 값보다 작으면 반복 계산이 중지됩니다.
리턴
Number
— 수렴 임곗값입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getLastColumn()
콘텐츠가 있는 마지막 열의 위치를 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This logs the value in the very last cell of this sheet var lastRow = sheet.getLastRow(); var lastColumn = sheet.getLastColumn(); var lastCell = sheet.getRange(lastRow, lastColumn); Logger.log(lastCell.getValue());
리턴
Integer
: 콘텐츠가 포함된 시트의 마지막 열
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getLastRow()
콘텐츠가 있는 마지막 행의 위치를 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This logs the value in the very last cell of this sheet var lastRow = sheet.getLastRow(); var lastColumn = sheet.getLastColumn(); var lastCell = sheet.getRange(lastRow, lastColumn); Logger.log(lastCell.getValue());
리턴
Integer
: 콘텐츠가 포함된 시트의 마지막 행
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getMaxIterativeCalculationCycles()
반복 계산 중 사용할 최대 반복 횟수를 반환합니다.
리턴
Integer
— 최대 계산 반복 횟수입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getName()
문서의 이름을 가져옵니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); Logger.log(ss.getName());
리턴
String
— 스프레드시트의 이름입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getNamedRanges()
이 스프레드시트에서 이름이 지정된 모든 범위를 가져옵니다.
// The code below logs the name of the first named range. var namedRanges = SpreadsheetApp.getActiveSpreadsheet().getNamedRanges(); for (var i = 0; i < namedRanges.length; i++) { Logger.log(namedRanges[i].getName()); }
리턴
NamedRange[]
- 스프레드시트에서 이름이 지정된 모든 범위의 배열
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getNumSheets()
이 스프레드시트의 시트 수를 반환합니다.
// The code below logs the number of sheets in the active spreadsheet. Logger.log(SpreadsheetApp.getActiveSpreadsheet().getNumSheets());
리턴
Integer
— 스프레드시트의 시트 수입니다.
getOwner()
문서 소유자를 반환하거나 공유 드라이브에 있는 문서의 경우 null
를 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var owner = ss.getOwner(); Logger.log(owner.getEmail());
리턴
User
- 문서 소유자 또는 문서가 공유 드라이브에 있는 경우 null
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getPredefinedSpreadsheetThemes()
사전 정의된 테마 목록을 반환합니다.
// The code below returns the list of predefined themes. var predefinedThemesList = SpreadsheetApp.getActiveSpreadsheet() .getPredefinedSpreadsheetThemes();
리턴
SpreadsheetTheme[]
- 사전 정의된 테마 목록
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getProtections(type)
스프레드시트의 모든 보호된 범위 또는 시트를 나타내는 객체의 배열을 가져옵니다.
// Remove all range protections in the spreadsheet that the user has permission to edit. var ss = SpreadsheetApp.getActive(); var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE); for (var i = 0; i < protections.length; i++) { var protection = protections[i]; if (protection.canEdit()) { protection.remove(); } }
// Remove all sheet protections in the spreadsheet that the user has permission to edit. var ss = SpreadsheetApp.getActive(); var protections = ss.getProtections(SpreadsheetApp.ProtectionType.SHEET); for (var i = 0; i < protections.length; i++) { var protection = protections[i]; if (protection.canEdit()) { protection.remove(); } }
매개변수
이름 | 유형 | 설명 |
---|---|---|
type | ProtectionType | 보호 영역의 유형(SpreadsheetApp.ProtectionType.RANGE 또는 SpreadsheetApp.ProtectionType.SHEET )입니다. |
리턴
Protection[]
: 스프레드시트의 모든 보호된 범위 또는 시트를 나타내는 객체의 배열입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getRange(a1Notation)
A1 표기법 또는 R1C1 표기법에 지정된 범위를 반환합니다.
// Get a range A1:D4 on sheet titled "Invoices" var ss = SpreadsheetApp.getActiveSpreadsheet(); var range = ss.getRange("Invoices!A1:D4"); // Get cell A1 on the first sheet var sheet = ss.getSheets()[0]; var cell = sheet.getRange("A1");
매개변수
이름 | 유형 | 설명 |
---|---|---|
a1Notation | String | A1 표기법 또는 R1C1 표기법에 지정된 대로 반환할 범위입니다. |
리턴
Range
— 지정된 위치의 범위입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getRangeByName(name)
이름이 지정된 범위를 반환하거나 지정된 이름의 범위가 없는 경우 null
을 반환합니다. 스프레드시트의 여러 시트에서 동일한 범위 이름을 사용하는 경우 추가 따옴표 없이 시트 이름을 지정합니다(예: getRangeByName('TaxRates')
또는 getRangeByName('Sheet Name!TaxRates')
, getRangeByName('"Sheet
Name"!TaxRates')
는 지정하지 않음).
// Log the number of columns for the range named 'TaxRates' in the active spreadsheet. var range = SpreadsheetApp.getActiveSpreadsheet().getRangeByName('TaxRates'); if (range != null) { Logger.log(range.getNumColumns()); }
매개변수
이름 | 유형 | 설명 |
---|---|---|
name | String | 가져올 범위의 이름입니다. |
리턴
Range
- 지정된 이름의 셀 범위
getRangeList(a1Notations)
비어 있지 않은 A1 표기법 목록이나 R1C1 표기법으로 지정된 동일한 시트의 범위를 나타내는 RangeList
컬렉션을 반환합니다.
// Get a list of ranges A1:D4, F1:H4. var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var rangeList = sheet.getRangeList(['A1:D4', 'F1:H4']);
매개변수
이름 | 유형 | 설명 |
---|---|---|
a1Notations | String[] | A1 표기법 또는 R1C1 표기법에 지정된 대로 반환할 범위의 목록입니다. |
리턴
RangeList
— 지정된 위치의 범위 목록입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getRecalculationInterval()
이 스프레드시트의 계산 간격을 반환합니다.
리턴
RecalculationInterval
— 이 스프레드시트의 계산 간격입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getRowHeight(rowPosition)
지정된 행의 높이를 픽셀 단위로 가져옵니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Rows start at 1 Logger.log(sheet.getRowHeight(1));
매개변수
이름 | 유형 | 설명 |
---|---|---|
rowPosition | Integer | 검사할 행의 위치입니다. |
리턴
Integer
— 픽셀 단위의 행 높이
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSelection()
스프레드시트의 현재 Selection
를 반환합니다.
var selection = SpreadsheetApp.getActiveSpreadsheet().getSelection(); var currentCell = selection.getCurrentCell();
리턴
Selection
— 현재 선택
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSheetByName(name)
지정된 이름의 시트를 반환합니다.
이름이 같은 시트가 여러 개 있으면 가장 왼쪽 시트가 반환됩니다. 지정된 이름의 시트가 없으면 null
를 반환합니다.
// The code below logs the index of a sheet named "Expenses" var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Expenses"); if (sheet != null) { Logger.log(sheet.getIndex()); }
매개변수
이름 | 유형 | 설명 |
---|---|---|
name | String | 가져올 시트의 이름입니다. |
리턴
Sheet
: 지정된 이름의 시트입니다.
getSheetId()
이 객체로 표시되는 시트의 ID를 반환합니다.
스프레드시트에 고유한 시트 ID입니다. ID는 시트 생성 시 할당되는 단조 증가 정수이며 시트 위치와 무관합니다. 이 방법은 Sheet
인스턴스가 아닌 gridId
매개변수를 사용하는 Range.copyFormatToRange(gridId, column, columnEnd, row, rowEnd)
와 같은 메서드와 함께 사용하면 유용합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; Logger.log(sheet.getSheetId());
리턴
Integer
: 스프레드시트 고유의 시트 ID
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSheetName()
시트 이름을 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; Logger.log(sheet.getSheetName());
리턴
String
— 시트의 이름입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSheetValues(startRow, startColumn, numRows, numColumns)
지정된 좌표에서 시작하여 이 범위에 해당하는 값의 직사각형 그리드를 반환합니다. 행 또는 열 위치로 지정된 -1 값은 시트에 데이터가 있는 맨 마지막 행이나 열을 가져오는 것과 같습니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // The two samples below produce the same output var values = sheet.getSheetValues(1, 1, 3, 3); Logger.log(values); var range = sheet.getRange(1, 1, 3, 3); values = range.getValues(); Logger.log(values);
매개변수
이름 | 유형 | 설명 |
---|---|---|
startRow | Integer | 시작 행의 위치입니다. |
startColumn | Integer | 시작 열의 위치입니다. |
numRows | Integer | 값을 반환할 행의 개수입니다. |
numColumns | Integer | 값을 반환할 열의 개수입니다. |
리턴
Object[][]
— 2차원 값 배열
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSheets()
이 스프레드시트의 모든 시트를 가져옵니다.
// The code below logs the name of the second sheet var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets(); if (sheets.length > 1) { Logger.log(sheets[1].getName()); }
리턴
Sheet[]
— 스프레드시트에 있는 모든 시트의 배열입니다.
getSpreadsheetLocale()
스프레드시트 언어를 가져옵니다.
리턴
String
— 스프레드시트 언어입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSpreadsheetTheme()
스프레드시트의 현재 테마를 반환하거나 테마가 적용되지 않은 경우 null
를 반환합니다.
// The code below returns the current theme of the spreadsheet. var currentTheme = SpreadsheetApp.getActiveSpreadsheet().getSpreadsheetTheme();
리턴
SpreadsheetTheme
: 현재 적용된 테마입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getSpreadsheetTimeZone()
getUrl()
지정된 스프레드시트의 URL을 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); Logger.log(ss.getUrl());
리턴
String
— 지정된 스프레드시트의 URL입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getViewers()
이 Spreadsheet
의 뷰어 및 댓글 작성자 목록을 가져옵니다.
리턴
User[]
— 보기 또는 댓글 권한이 있는 사용자의 배열입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
hideColumn(column)
지정된 범위의 열을 숨깁니다.
let ss = SpreadsheetApp.getActiveSpreadsheet(); let sheet = ss.getSheets()[0]; // This hides the first column let range = sheet.getRange("A1"); sheet.hideColumn(range); // This hides the first 3 columns let range = sheet.getRange("A:C"); sheet.hideColumn(range);
매개변수
이름 | 유형 | 설명 |
---|---|---|
column | Range | 숨길 열 범위입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
hideRow(row)
지정된 범위의 행을 숨깁니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This hides the first row var range = sheet.getRange("A1"); sheet.hideRow(range);
매개변수
이름 | 유형 | 설명 |
---|---|---|
row | Range | 숨길 행 범위입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertColumnAfter(afterPosition)
지정된 열 위치 뒤에 열을 삽입합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This inserts a column after the first column position sheet.insertColumnAfter(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
afterPosition | Integer | 그 뒤에 새 열을 추가해야 합니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertColumnBefore(beforePosition)
지정된 열 위치 앞에 열을 삽입합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This inserts a column in the first column position sheet.insertColumnBefore(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
beforePosition | Integer | 새 열을 추가해야 하는 열입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertColumnsAfter(afterPosition, howMany)
지정된 열 위치 뒤에 여러 열을 삽입합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This inserts a column in the second column position sheet.insertColumnsAfter(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
afterPosition | Integer | 그 뒤에 새 열을 추가해야 합니다. |
howMany | Integer | 삽입할 열의 개수입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertColumnsBefore(beforePosition, howMany)
지정된 열 위치 앞에 여러 열을 삽입합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This inserts five columns before the first column sheet.insertColumnsBefore(1, 5);
매개변수
이름 | 유형 | 설명 |
---|---|---|
beforePosition | Integer | 새 열을 추가해야 하는 열입니다. |
howMany | Integer | 삽입할 열의 개수입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertDataSourceSheet(spec)
스프레드시트에 새 DataSourceSheet
를 삽입하고 데이터 실행을 시작합니다. 또한 새 시트가 활성 시트가 됩니다.
데이터 소스 유형이 사용 설정되지 않은 경우 예외가 발생합니다. SpreadsheetApp#enable...Execution()
메서드를 사용하여 특정 데이터 소스 유형의 데이터 실행을 사용 설정합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
spec | DataSourceSpec | 삽입할 데이터 소스 사양입니다. |
리턴
DataSourceSheet
— 새 데이터 소스 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertImage(blobSource, column, row)
지정된 행과 열에 있는 문서의 이미지로 Spreadsheet
을 삽입합니다. 이미지 크기는 blob 콘텐츠에서 가져옵니다. 지원되는 최대 blob 크기는 2MB입니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var blob = Utilities.newBlob(binaryData, 'image/png', 'MyImageName'); sheet.insertImage(blob, 1, 1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
blobSource | BlobSource | 이미지 콘텐츠, MIME 유형, 이름 (선택사항)이 포함된 blob입니다. |
column | Integer | 열 위치입니다. |
row | Integer | 행 위치입니다. |
리턴
OverGridImage
- 삽입된 이미지입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertImage(blobSource, column, row, offsetX, offsetY)
픽셀 오프셋을 사용하여 문서의 지정된 행과 열에 Spreadsheet
를 이미지로 삽입합니다. 이미지 크기는 blob 콘텐츠에서 가져옵니다. 지원되는 최대 blob 크기는 2MB입니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var blob = Utilities.newBlob(binaryData, 'image/png', 'MyImageName'); sheet.insertImage(blob, 1, 1, 10, 10);
매개변수
이름 | 유형 | 설명 |
---|---|---|
blobSource | BlobSource | 이미지 콘텐츠, MIME 유형, 이름 (선택사항)이 포함된 blob입니다. |
column | Integer | 열 위치입니다. |
row | Integer | 행 위치입니다. |
offsetX | Integer | 셀 모서리로부터의 수평 오프셋(픽셀)입니다. |
offsetY | Integer | 셀 모서리의 픽셀 단위 수직 오프셋입니다. |
리턴
OverGridImage
- 삽입된 이미지입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertImage(url, column, row)
지정된 행과 열에 있는 문서에 이미지를 삽입합니다.
제공된 URL은 공개적으로 액세스할 수 있어야 합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; sheet.insertImage("https://www.google.com/images/srpr/logo3w.png", 1, 1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
url | String | 이미지의 URL입니다. |
column | Integer | 그리드 열 위치입니다. |
row | Integer | 그리드 행 위치입니다. |
리턴
OverGridImage
- 삽입된 이미지입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertImage(url, column, row, offsetX, offsetY)
픽셀 오프셋을 사용하여 지정된 행과 열의 문서에 이미지를 삽입합니다.
제공된 URL은 공개적으로 액세스할 수 있어야 합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; sheet.insertImage("https://www.google.com/images/srpr/logo3w.png", 1, 1, 10, 10);
매개변수
이름 | 유형 | 설명 |
---|---|---|
url | String | 이미지의 URL입니다. |
column | Integer | 열 위치입니다. |
row | Integer | 행 위치입니다. |
offsetX | Integer | 셀 모서리로부터의 수평 오프셋(픽셀)입니다. |
offsetY | Integer | 셀 모서리의 픽셀 단위 수직 오프셋입니다. |
리턴
OverGridImage
- 삽입된 이미지입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertRowAfter(afterPosition)
지정된 행 위치 뒤에 행을 삽입합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This inserts a row after the first row position sheet.insertRowAfter(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
afterPosition | Integer | 그 뒤에 새 행을 추가해야 하는 행입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertRowBefore(beforePosition)
지정된 행 위치 앞에 행을 삽입합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This inserts a row before the first row position sheet.insertRowBefore(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
beforePosition | Integer | 새 행을 추가해야 하는 행입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertRowsAfter(afterPosition, howMany)
지정된 행 위치 뒤에 지정된 수의 행을 삽입합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This inserts five rows after the first row sheet.insertRowsAfter(1, 5);
매개변수
이름 | 유형 | 설명 |
---|---|---|
afterPosition | Integer | 그 뒤에 새 행을 추가해야 하는 행입니다. |
howMany | Integer | 삽입할 행 수입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertRowsBefore(beforePosition, howMany)
지정된 행 위치 앞에 여러 행을 삽입합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This inserts five rows before the first row sheet.insertRowsBefore(1, 5);
매개변수
이름 | 유형 | 설명 |
---|---|---|
beforePosition | Integer | 새 행을 추가해야 하는 행입니다. |
howMany | Integer | 삽입할 행 수입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertSheet()
insertSheet(sheetIndex)
지정된 색인의 스프레드시트에 새 시트를 삽입합니다. 새 시트가 활성 시트가 됩니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.insertSheet(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheetIndex | Integer | 새로 생성된 시트의 색인입니다. 스프레드시트의 첫 번째 시트로 시트를 삽입하려면 0으로 설정하세요. |
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertSheet(sheetIndex, options)
지정된 색인의 스프레드시트에 새 시트를 삽입하고 선택적 고급 인수를 사용합니다. 새 시트가 활성 시트가 됩니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var templateSheet = ss.getSheetByName('Sales'); ss.insertSheet(1, {template: templateSheet});
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheetIndex | Integer | 새로 생성된 시트의 색인입니다. 스프레드시트의 첫 번째 시트로 시트를 삽입하려면 0으로 설정하세요. |
options | Object | 자바스크립트 고급 인수(선택사항)입니다. |
고급 매개변수
이름 | 유형 | 설명 |
---|---|---|
template | Sheet | 템플릿 시트 객체의 모든 데이터가 새 시트에 복사됩니다. 시트 템플릿은 스프레드시트 객체의 시트 중 하나여야 합니다. |
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertSheet(options)
기본 시트 이름과 고급 고급 인수를 사용하여 새 시트를 스프레드시트에 삽입합니다. 새 시트가 활성 시트가 됩니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var templateSheet = ss.getSheetByName('Sales'); ss.insertSheet({template: templateSheet});
매개변수
이름 | 유형 | 설명 |
---|---|---|
options | Object | 아래에 나열된 자바스크립트 고급 인수(선택사항)입니다. |
고급 매개변수
이름 | 유형 | 설명 |
---|---|---|
template | Sheet | 템플릿 시트 객체의 모든 데이터가 새 시트에 복사됩니다. 시트 템플릿은 이 스프레드시트 객체의 시트 중 하나여야 합니다. |
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertSheet(sheetName)
지정된 이름의 스프레드시트에 새 시트를 삽입합니다. 새 시트가 활성 시트가 됩니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.insertSheet('My New Sheet');
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheetName | String | 새 시트의 이름입니다. |
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertSheet(sheetName, sheetIndex)
지정된 색인에서 지정된 이름의 스프레드시트에 새 시트를 삽입합니다. 새 시트가 활성 시트가 됩니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.insertSheet('My New Sheet', 1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheetName | String | 새 시트의 이름입니다. |
sheetIndex | Integer | 새로 생성된 시트의 색인입니다. 스프레드시트의 첫 번째 시트로 시트를 삽입하려면 0으로 설정하세요. |
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertSheet(sheetName, sheetIndex, options)
지정된 색인에서 지정된 이름의 스프레드시트에 새 시트를 삽입하고 선택적 고급 인수를 사용합니다. 새 시트가 활성 시트가 됩니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var templateSheet = ss.getSheetByName('Sales'); ss.insertSheet('My New Sheet', 1, {template: templateSheet});
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheetName | String | 새 시트의 이름입니다. |
sheetIndex | Integer | 새로 삽입된 시트의 색인입니다. 스프레드시트의 첫 번째 시트로 시트를 삽입하려면 0으로 설정하세요. |
options | Object | 자바스크립트 고급 인수(선택사항)입니다. |
고급 매개변수
이름 | 유형 | 설명 |
---|---|---|
template | Sheet | 템플릿 시트 객체의 모든 데이터가 새 시트에 복사됩니다. 시트 템플릿은 스프레드시트 객체의 시트 중 하나여야 합니다. |
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertSheet(sheetName, options)
지정된 이름의 스프레드시트에 새 시트를 삽입하고 선택적 고급 인수를 사용합니다. 새 시트가 활성 시트가 됩니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var templateSheet = ss.getSheetByName('Sales'); ss.insertSheet('My New Sheet', {template: templateSheet});
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheetName | String | 새 시트의 이름입니다. |
options | Object | 자바스크립트 고급 인수(선택사항)입니다. |
고급 매개변수
이름 | 유형 | 설명 |
---|---|---|
template | Sheet | 템플릿 시트 객체의 모든 데이터가 새 시트에 복사됩니다. 시트 템플릿은 스프레드시트 객체의 시트 중 하나여야 합니다. |
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
insertSheetWithDataSourceTable(spec)
스프레드시트에 새 시트를 삽입하고 지정된 데이터 소스 사양으로 전체 시트를 포괄하는 DataSourceTable
를 만든 후 데이터 실행을 시작합니다. 부수적으로 새 시트를 활성 시트로 만듭니다.
데이터 소스 유형이 사용 설정되지 않은 경우 예외가 발생합니다. SpreadsheetApp#enable...Execution()
메서드를 사용하여 특정 데이터 소스 유형의 데이터 실행을 사용 설정합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
spec | DataSourceSpec | 삽입할 데이터 소스 사양입니다. |
리턴
Sheet
— 새 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
isColumnHiddenByUser(columnPosition)
사용자가 특정 열을 숨기는지 여부를 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Columns start at 1 Logger.log(sheet.isColumnHiddenByUser(1));
매개변수
이름 | 유형 | 설명 |
---|---|---|
columnPosition | Integer | 검사할 열의 위치입니다. |
리턴
Boolean
— 열이 숨겨져 있으면 true
, 그 밖의 경우에는 false
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
isIterativeCalculationEnabled()
이 스프레드시트에 반복 계산이 사용 설정되어 있는지 여부를 반환합니다.
리턴
Boolean
— 반복 계산이 사용 설정된 경우 true
, 그렇지 않은 경우 false
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
isRowHiddenByFilter(rowPosition)
지정된 행이 필터 (필터 보기 아님)에 의해 숨겨졌는지 여부를 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Rows start at 1 Logger.log(sheet.isRowHiddenByFilter(1));
매개변수
이름 | 유형 | 설명 |
---|---|---|
rowPosition | Integer | 검사할 행의 위치입니다. |
리턴
Boolean
— 행이 숨겨져 있으면 true
, 그 밖의 경우에는 false
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
isRowHiddenByUser(rowPosition)
사용자가 특정 행을 숨겼는지 여부를 반환합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Rows start at 1 Logger.log(sheet.isRowHiddenByUser(1));
매개변수
이름 | 유형 | 설명 |
---|---|---|
rowPosition | Integer | 검사할 행의 위치입니다. |
리턴
Boolean
— 행이 숨겨져 있으면 true
, 그 밖의 경우에는 false
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
moveActiveSheet(pos)
활성 시트를 시트 목록의 지정된 위치로 이동합니다. 위치가 음수이거나 시트 수보다 크면 예외가 발생합니다.
// This example assumes that there are 2 sheets in the current // active spreadsheet: one named "first" in position 1 and another named "second" // in position 2. var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); // Gets the "first" sheet and activates it. var sheet = spreadsheet.getSheetByName("first").activate(); // Logs 'Current index of sheet: 1' console.log("Current index of sheet: %s", sheet.getIndex()); spreadsheet.moveActiveSheet(2); // Logs 'New index of sheet: 2' console.log("New index of sheet: %s", sheet.getIndex());
매개변수
이름 | 유형 | 설명 |
---|---|---|
pos | Integer | 시트 목록에서 활성 시트를 이동할 1 색인 위치입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
moveChartToObjectSheet(chart)
새 SheetType.OBJECT
시트를 만들고 제공된 차트를 이 시트로 이동합니다. 차트가 이미 해당 시트에 있는 경우 새 시트는 만들지 않고 해당 시트가 반환됩니다.
var sheet = SpreadsheetApp.getActiveSheet(); var chart = sheet.newChart().setPosition(1, 1, 0, 0).build(); sheet.insertChart(chart); var objectSheet = SpreadsheetApp.getActive().moveChartToObjectSheet(chart);
매개변수
이름 | 유형 | 설명 |
---|---|---|
chart | EmbeddedChart | 이동할 차트입니다. |
리턴
Sheet
— 차트가 있는 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
refreshAllDataSources()
지원되는 모든 데이터 소스 및 연결된 데이터 소스 객체를 새로고침하고 잘못된 데이터 소스 객체는 건너뜁니다.
SpreadsheetApp#enable...Execution()
메서드를 사용하여 특정 데이터 소스 유형의 데이터 실행을 사용 설정합니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
removeEditor(emailAddress)
Spreadsheet
의 편집자 목록에서 지정된 사용자를 삭제합니다. 이 메서드는 일반 액세스 권한을 가진 사용자 클래스에 속한 경우(예: Spreadsheet
이 사용자의 전체 도메인과 공유되었거나 Spreadsheet
가 사용자가 액세스할 수 있는 공유 드라이브에 있는 경우) 사용자가 Spreadsheet
에 액세스하는 것을 차단하지 않습니다.
Drive 파일의 경우 뷰어 목록에서도 사용자가 삭제됩니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
emailAddress | String | 삭제할 사용자의 이메일 주소입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
removeEditor(user)
Spreadsheet
의 편집자 목록에서 지정된 사용자를 삭제합니다. 이 메서드는 일반 액세스 권한을 가진 사용자 클래스에 속한 경우(예: Spreadsheet
이 사용자의 전체 도메인과 공유되었거나 Spreadsheet
가 사용자가 액세스할 수 있는 공유 드라이브에 있는 경우) 사용자가 Spreadsheet
에 액세스하는 것을 차단하지 않습니다.
Drive 파일의 경우 뷰어 목록에서도 사용자가 삭제됩니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
user | User | 삭제할 사용자의 표현입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
removeMenu(name)
addMenu(name, subMenus)
에서 추가한 메뉴를 삭제합니다. name
인수는 addMenu(name, subMenus)
에 대한 호출과 동일한 값을 가져야 합니다.
// The onOpen function is executed automatically every time a Spreadsheet is loaded function onOpen() { var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.addMenu("badMenu", [{name: "remove bad menu", functionName: "removeBadMenu"}, {name: "foo", functionName: "foo"}]); } function removeBadMenu() { var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.removeMenu("badMenu"); // name must match the name used when added the menu } function foo(){ // Do nothing }
매개변수
이름 | 유형 | 설명 |
---|---|---|
name | String | 삭제할 메뉴의 이름입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
removeNamedRange(name)
지정된 이름으로 이름이 지정된 범위를 삭제합니다. 지정된 이름의 범위가 스프레드시트에 없으면 예외가 발생합니다.
// The code below creates a new named range "foo", and then remove it. var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.setNamedRange("foo", ss.getActiveRange()); ss.removeNamedRange("foo");
매개변수
이름 | 유형 | 설명 |
---|---|---|
name | String | 범위 이름입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
removeViewer(emailAddress)
Spreadsheet
의 뷰어 및 댓글 작성자 목록에서 지정된 사용자를 삭제합니다. 이 메서드는 뷰어 또는 댓글 작성자가 아닌 편집자인 경우 영향을 미치지 않습니다. 이 메서드는 일반 액세스 권한을 가진 사용자 클래스에 속한 경우(예: Spreadsheet
이 사용자의 전체 도메인과 공유되었거나 Spreadsheet
가 사용자가 액세스할 수 있는 공유 드라이브에 있는 경우) 사용자가 Spreadsheet
에 액세스하는 것을 차단하지 않습니다.
Drive 파일의 경우 편집자 목록에서도 사용자가 삭제됩니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
emailAddress | String | 삭제할 사용자의 이메일 주소입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
removeViewer(user)
Spreadsheet
의 뷰어 및 댓글 작성자 목록에서 지정된 사용자를 삭제합니다. 이 메서드는 사용자가 뷰어가 아닌 편집자인 경우 영향을 미치지 않습니다. 또한 이 메서드는 일반 액세스 권한을 가진 사용자 클래스에 속한 경우(예: Spreadsheet
이 사용자의 전체 도메인과 공유되었거나 Spreadsheet
가 사용자가 액세스할 수 있는 공유 드라이브에 있는 경우) 사용자가 Spreadsheet
에 액세스하는 것을 차단하지 않습니다.
Drive 파일의 경우 편집자 목록에서도 사용자가 삭제됩니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
user | User | 삭제할 사용자의 표현입니다. |
리턴
Spreadsheet
: 체이닝용 Spreadsheet
입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
rename(newName)
문서 이름을 바꿉니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.rename("This is the new name");
매개변수
이름 | 유형 | 설명 |
---|---|---|
newName | String | 문서의 새 이름입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
renameActiveSheet(newName)
현재 활성 시트의 이름을 지정된 새 이름으로 바꿉니다.
// The code below renames the active sheet to "Hello world" SpreadsheetApp.getActiveSpreadsheet().renameActiveSheet("Hello world");
매개변수
이름 | 유형 | 설명 |
---|---|---|
newName | String | 현재 활성 시트의 새 이름입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
resetSpreadsheetTheme()
적용된 테마를 삭제하고 스프레드시트에서 기본 테마를 설정합니다.
// The code below applies default theme on the spreadsheet. SpreadsheetApp.getActiveSpreadsheet().resetSpreadsheetTheme();
리턴
SpreadsheetTheme
: 기본 테마입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setActiveRange(range)
활성 시트에서 지정된 범위를 active range
로 설정하고 범위의 왼쪽 상단 셀을 current cell
로 설정합니다.
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var range = sheet.getRange('A1:D4'); sheet.setActiveRange(range); var selection = sheet.getSelection(); // Current cell: A1 var currentCell = selection.getCurrentCell(); // Active Range: A1:D4 var activeRange = selection.getActiveRange();
매개변수
이름 | 유형 | 설명 |
---|---|---|
range | Range | 활성 범위로 설정할 범위입니다. |
리턴
Range
— 새로 활성화된 범위
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setActiveRangeList(rangeList)
지정된 범위 목록을 활성 시트에서 active ranges
로 설정합니다. 목록의 마지막 범위는 active range
로 설정됩니다.
var sheet = SpreadsheetApp.getActiveSheet(); var rangeList = sheet.getRangeList(['D4', 'B2:C4']); sheet.setActiveRangeList(rangeList); var selection = sheet.getSelection(); // Current cell: B2 var currentCell = selection.getCurrentCell(); // Active range: B2:C4 var activeRange = selection.getActiveRange(); // Active range list: [D4, B2:C4] var activeRangeList = selection.getActiveRangeList();
매개변수
이름 | 유형 | 설명 |
---|---|---|
rangeList | RangeList | 선택할 범위의 목록입니다. |
리턴
RangeList
: 새로 선택된 범위 목록
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setActiveSelection(range)
이 시트의 활성 선택 지역을 설정합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var range = sheet.getRange("A1:D4"); sheet.setActiveSelection(range);
매개변수
이름 | 유형 | 설명 |
---|---|---|
range | Range | 활성 선택으로 설정할 범위입니다. |
리턴
Range
— 새로 활성화된 범위
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setActiveSelection(a1Notation)
A1 표기법 또는 R1C1 표기법에 지정된 대로 활성 선택을 설정합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; sheet.setActiveSelection("A1:D4");
매개변수
이름 | 유형 | 설명 |
---|---|---|
a1Notation | String | A1 또는 R1C1 표기법에 지정된 대로 활성으로 설정할 범위입니다. |
리턴
Range
— 새로 활성화된 범위
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setActiveSheet(sheet)
지정된 시트를 스프레드시트의 활성 시트로 설정합니다. 다른 시트에 속하지 않는 한 Google Sheets UI가 선택된 시트를 표시합니다.
// The code below makes the first sheet active in the active spreadsheet. var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); spreadsheet.setActiveSheet(spreadsheet.getSheets()[0]);
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheet | Sheet | 활성 시트로 설정할 시트입니다. |
리턴
Sheet
— 활성 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setActiveSheet(sheet, restoreSelection)
지정된 시트를 스프레드시트의 활성 시트로 설정하며, 그 시트 내에서 가장 최근 선택을 복원할 수 있는 옵션이 제공됩니다. 시트가 다른 스프레드시트에 속하지 않는 한 Google Sheets UI에서 선택한 시트를 표시합니다.
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); var firstSheet = spreadsheet.getSheets()[0]; var secondSheet = spreadsheet.getSheets()[1]; // Set the first sheet as the active sheet and select the range D4:F4. spreadsheet.setActiveSheet(firstSheet).getRange('D4:F4').activate(); // Switch to the second sheet to do some work. spreadsheet.setActiveSheet(secondSheet); // Switch back to first sheet, and restore its selection. spreadsheet.setActiveSheet(firstSheet, true); // The selection of first sheet is restored, and it logs D4:F4 var range = spreadsheet.getActiveSheet().getSelection().getActiveRange(); Logger.log(range.getA1Notation());
매개변수
이름 | 유형 | 설명 |
---|---|---|
sheet | Sheet | 새 활성 시트입니다. |
restoreSelection | Boolean | true 인 경우 새 시트가 활성화되면 새 활성 시트의 최근 선택이 다시 선택됩니다. false 인 경우 현재 선택이 변경되지 않고 새 시트가 활성화됩니다. |
리턴
Sheet
— 새 활성 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setColumnWidth(columnPosition, width)
지정된 열의 너비를 픽셀로 설정합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Sets the first column to a width of 200 pixels sheet.setColumnWidth(1, 200);
매개변수
이름 | 유형 | 설명 |
---|---|---|
columnPosition | Integer | 설정할 특정 열의 위치입니다. |
width | Integer | 픽셀로 설정할 너비입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setCurrentCell(cell)
지정된 셀을 current cell
로 설정합니다.
지정된 셀이 이미 선택된 범위에 있으면 이 범위는 셀을 현재 셀로 사용하는 활성 범위가 됩니다.
지정된 셀이 선택된 범위에 없으면 기존의 선택 항목이 삭제되고 셀이 현재 셀 및 활성 범위가 됩니다.
참고: 지정된 Range
는 하나의 셀로 구성되어야 하며, 그렇지 않으면 예외가 발생합니다.
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var cell = sheet.getRange('B5'); sheet.setCurrentCell(cell); var selection = sheet.getSelection(); // Current cell: B5 var currentCell = selection.getCurrentCell();
매개변수
이름 | 유형 | 설명 |
---|---|---|
cell | Range | 현재 셀로 설정할 셀입니다. |
리턴
Range
: 새로 설정된 현재 셀
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setFrozenColumns(columns)
지정된 수의 열을 고정합니다. 0이면 고정된 열이 없습니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Freezes the first column sheet.setFrozenColumns(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
columns | Integer | 고정할 열의 개수입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setFrozenRows(rows)
지정된 수의 행을 고정합니다. 0이면 고정된 행이 없습니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Freezes the first row sheet.setFrozenRows(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
rows | Integer | 고정할 행 수입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setIterativeCalculationConvergenceThreshold(minThreshold)
반복 계산을 위한 최소 임곗값을 설정합니다. 연속 계산 결과가 이 값보다 작으면 반복 계산이 중지됩니다. 이 값은 음수가 아니어야 하며 기본값은 0.05입니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
minThreshold | Number | 최소 수렴 기준 (음수가 아니어야 함) |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setIterativeCalculationEnabled(isEnabled)
이 스프레드시트에 반복 계산을 사용 설정할지 여부를 설정합니다. 계산을 사용 설정할 때 이전에 최대 계산 주기 수와 수렴 기준점을 설정하지 않은 경우 기본값은 각각 50 및 0.05입니다. 둘 중 하나가 이전에 설정된 경우 이전 값이 유지됩니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
isEnabled | Boolean | 반복 계산을 사용 설정해야 하는 경우 true , 그러지 않으면 false 입니다. |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setMaxIterativeCalculationCycles(maxIterations)
반복 계산 시 수행해야 하는 최대 계산 반복 횟수를 설정합니다. 이 값은 1에서 10,000 (포함) 사이여야 하며 기본값은 50입니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
maxIterations | Integer | 최대 계산 반복 횟수 (1~10,000) |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setNamedRange(name, range)
범위의 이름을 지정합니다.
// The code below creates a new named range "TaxRates" in the active spreadsheet var ss = SpreadsheetApp.getActiveSpreadsheet(); ss.setNamedRange("TaxRates", SpreadsheetApp.getActiveRange());
매개변수
이름 | 유형 | 설명 |
---|---|---|
name | String | 범위에 지정할 이름입니다. |
range | Range | 범위 사양입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setRecalculationInterval(recalculationInterval)
이 스프레드시트를 다시 계산하는 빈도를 설정합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
recalculationInterval | RecalculationInterval | 새 재계산 간격입니다. |
리턴
Spreadsheet
— 연계용 스프레드시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setRowHeight(rowPosition, height)
지정된 행의 행 높이를 픽셀 단위로 설정합니다. 기본적으로 행은 셀 내용에 맞게 확장됩니다. 행을 지정된 높이로 강제 지정하려면 Sheet.setRowHeightsForced(startRow, numRows, height)
를 사용하세요.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Sets the first row to a height of 200 pixels sheet.setRowHeight(1, 200);
매개변수
이름 | 유형 | 설명 |
---|---|---|
rowPosition | Integer | 변경할 행 위치입니다. |
height | Integer | 픽셀 단위로 설정할 높이입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setSpreadsheetLocale(locale)
스프레드시트 언어를 설정합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
locale | String | 사용할 언어 코드입니다 (예: 'en', 'fr', 'en_US'). |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setSpreadsheetTheme(theme)
스프레드시트의 테마를 설정합니다.
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); // The code below sets the second predefined theme as the current theme of the spreadsheet. var predefinedThemesList = spreadsheet.getPredefinedSpreadsheetThemes(); spreadsheet.setSpreadsheetTheme(predefinedThemesList[1]);
매개변수
이름 | 유형 | 설명 |
---|---|---|
theme | SpreadsheetTheme | 적용할 테마. |
리턴
SpreadsheetTheme
: 새로운 현재 테마입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setSpreadsheetTimeZone(timezone)
show(userInterface)
사용자 브라우저 뷰포트의 중심에 있는 대화상자에 맞춤 사용자 인터페이스 구성요소를 표시합니다. 서버 측 스크립트의 실행이 정지되지 않습니다. 서버 측과 통신하려면 사용자 인터페이스 구성요소가 서버 측 스크립트로 비동기 콜백을 수행해야 합니다.
이전에 서버 측 스크립트가 닫히지 않은 대화상자를 표시했다면 기존 대화상자가 새로 요청된 대화상자의 사용자 인터페이스로 바뀝니다.
다음 코드 스니펫은 지정된 제목, 높이, 너비가 있는 간단한 HtmlService
애플리케이션을 대화상자에 표시합니다.
var htmlApp = HtmlService .createHtmlOutput('<p>A change of speed, a change of style...</p>') .setTitle('My HtmlService Application') .setWidth(250) .setHeight(300); SpreadsheetApp.getActiveSpreadsheet().show(htmlApp); // The script resumes execution immediately after showing the dialog.
매개변수
이름 | 유형 | 설명 |
---|---|---|
userInterface | Object | HtmlOutput |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/script.container.ui
sort(columnPosition)
시트를 열별로 오름차순으로 정렬합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Sorts the sheet by the first column, ascending sheet.sort(1);
매개변수
이름 | 유형 | 설명 |
---|---|---|
columnPosition | Integer | 정렬할 열입니다. |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
sort(columnPosition, ascending)
시트를 열별로 정렬합니다. 매개변수를 사용하여 오름차순 또는 내림차순을 지정합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Sorts the sheet by the first column, descending sheet.sort(1, false);
매개변수
이름 | 유형 | 설명 |
---|---|---|
columnPosition | Integer | 정렬할 열입니다. |
ascending | Boolean | 오름차순 정렬 시 true , 내림차순 정렬 시 false |
리턴
Sheet
— 메서드 체이닝에 유용한 시트입니다.
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
toast(msg)
스프레드시트의 오른쪽 하단에 해당 메시지가 포함된 팝업 창을 표시합니다.
// Show a popup with the message "Task started". SpreadsheetApp.getActiveSpreadsheet().toast('Task started');
매개변수
이름 | 유형 | 설명 |
---|---|---|
msg | String | 토스트에 표시할 메시지입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
toast(msg, title)
스프레드시트의 오른쪽 하단에 지정된 메시지 및 제목과 함께 팝업 창이 표시됩니다.
// Show a popup with the title "Status" and the message "Task started". SpreadsheetApp.getActiveSpreadsheet().toast('Task started', 'Status');
매개변수
이름 | 유형 | 설명 |
---|---|---|
msg | String | 토스트에 표시할 메시지입니다. |
title | String | 토스트의 제목(선택사항)입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
toast(msg, title, timeoutSeconds)
스프레드시트의 오른쪽 하단에 특정 기간 동안 표시되는 제목과 메시지가 포함된 팝업 창을 표시합니다.
// Show a 3-second popup with the title "Status" and the message "Task started". SpreadsheetApp.getActiveSpreadsheet().toast('Task started', 'Status', 3);
매개변수
이름 | 유형 | 설명 |
---|---|---|
msg | String | 토스트에 표시할 메시지입니다. |
title | String | 토스트의 제목(선택사항)입니다. |
timeoutSeconds | Number | 제한 시간(초). null 인 경우 토스트의 기본값은 5초입니다.
음수이면 토스트 메시지는 해제될 때까지 유지됩니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
unhideColumn(column)
지정된 범위의 열을 숨기기 해제합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This unhides the first column if it was previously hidden var range = sheet.getRange("A1"); sheet.unhideColumn(range);
매개변수
이름 | 유형 | 설명 |
---|---|---|
column | Range | 숨기기를 해제할 범위입니다(숨긴 경우). |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
unhideRow(row)
지정된 범위의 행을 숨기기 해제합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // This unhides the first row if it was previously hidden var range = sheet.getRange("A1"); sheet.unhideRow(range);
매개변수
이름 | 유형 | 설명 |
---|---|---|
row | Range | 숨기기를 해제할 범위입니다(숨긴 경우). |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
updateMenu(name, subMenus)
addMenu(name, subMenus)
에서 추가한 메뉴를 업데이트합니다. addMenu(name, subMenus)
와 똑같이 작동합니다.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var menuEntries = []; menuEntries.push({name: "Lone Menu Entry", functionName: "function1"}); ss.updateMenu("addMenuExample", menuEntries);
매개변수
이름 | 유형 | 설명 |
---|---|---|
name | String | 업데이트할 메뉴의 이름입니다. |
subMenus | Object[] | name 및 functionName
매개변수가 포함된 자바스크립트 맵의 배열입니다. 포함된 라이브러리의 함수(예:
Library.libFunction1 )를 사용할 수 있습니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
waitForAllDataExecutionsCompletion(timeoutInSeconds)
지정된 시간(초)이 지나면 스프레드시트의 모든 현재 실행이 완료될 때까지 대기합니다. 시간 초과 시 실행이 완료되지 않지만 데이터 실행이 취소되지 않으면 예외가 발생합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
timeoutInSeconds | Integer | 데이터 실행을 기다리는 시간(초)입니다. 최대 길이는 300초입니다. |
승인
이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets