빠른 시작에서는 Google Workspace API를 호출하는 앱을 설정하고 실행하는 방법을 설명합니다.
Google Workspace 빠른 시작에서는 API 클라이언트 라이브러리를 사용하여 인증 및 승인 흐름의 일부 세부정보를 처리합니다. 자체 앱에는 클라이언트 라이브러리를 사용하는 것이 좋습니다. 이 빠른 시작에서는 테스트 환경에 적합한 간소화된 인증 접근 방식을 사용합니다. 프로덕션 환경의 경우 앱에 적합한 액세스 사용자 인증 정보를 선택하기 전에 인증 및 승인에 관해 알아보는 것이 좋습니다.
/** * Creates a Sheets API service object and prints the names and majors of * students in a sample spreadsheet: * https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get */functionlogNamesAndMajors(){constspreadsheetId='1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms';constrangeName='ClassData!A2:E';try{// Get the values from the spreadsheet using spreadsheetId and range.constvalues=Sheets.Spreadsheets.Values.get(spreadsheetId,rangeName).values;// Print the values from spreadsheet if values are available.if(!values){console.log('Nodatafound.');return;}console.log('Name,Major:');for(constrowinvalues){// Print columns A and E, which correspond to indices 0 and 4.console.log('-%s,%s',values[row][0],values[row][4]);}}catch(err){// TODO (developer) - Handle Values.get() exception from Sheet APIconsole.log(err.message);}}
[null,null,["최종 업데이트: 2024-12-21(UTC)"],[[["This quickstart demonstrates how to use Google Apps Script to connect to and retrieve data from the Google Sheets API."],["You will need a Google Account and access to Google Drive to complete the setup."],["The process involves creating a script, enabling the Google Sheets API, and authorizing access for the script to interact with your spreadsheets."],["Upon successful execution, the script will print data from a sample spreadsheet to the execution log."],["For production environments, further exploration of authentication, authorization, and credential management is recommended."]]],[]]