실행 정보
실행 중인 스크립트 정보
ExecutionInfo
객체의 메서드를 통해 실행 중인 스크립트의 특정 속성에 액세스할 수 있습니다. 예를 들어 isPreview()
는 스크립트가 현재 미리 보고 있는지 아니면 실제로 실행 중인지 알려줍니다.
이렇게 하면 코드 디버깅이 간소화되는 경우가 많습니다.
// Code that generates a report.
// ...
if (!AdsApp.getExecutionInfo().isPreview()) {
// Do not email the report when in preview mode!
MailApp.sendEmail("customer@example.com", "Report is ready!", report);
}
스크립트 계정 정보
실행 중인 스크립트의 계정 정보는 특히 변경되지 않은 동일한 스크립트가 여러 계정에서 사용되는 경우에 종종 필요합니다. 스크립트가 보고서를 이메일로 전송하는 경우 수신자가 발신 계정을 식별해야 합니다. 이를 위해 Account
객체의 getCustomerId()
메서드를 사용할 수 있습니다.
let accountId = AdsApp.currentAccount().getCustomerId();
MailApp.sendEmail("customer@example.com",
"Report is ready for " + accountId, report);
Account
객체에는 계정의 통화 및 시간대를 식별할 수 있는 메서드도 있습니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-03-04(UTC)
[null,null,["최종 업데이트: 2025-03-04(UTC)"],[[["Access attributes of a running script using the `ExecutionInfo` object, such as determining if the script is in preview mode with `isPreview()`."],["Utilize the `Account` object to retrieve account information like customer ID (`getCustomerId()`), currency, and time zone, particularly useful when a single script operates across multiple accounts."],["Simplify debugging and reporting by conditionally executing code based on the script's execution mode and including account-specific details in outputs like emails."]]],[]]