ข้อมูลการดําเนินการ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ข้อมูลเกี่ยวกับสคริปต์ที่ทำงานอยู่
คุณสามารถเข้าถึงแอตทริบิวต์บางอย่างของสคริปต์ที่ทำงานอยู่ผ่านเมธอดของออบเจ็กต์ 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);
}
ข้อมูลเกี่ยวกับบัญชีของสคริปต์
ข้อมูลบัญชีสําหรับสคริปต์ที่ทํางานมักจําเป็น โดยเฉพาะอย่างยิ่งเมื่อใช้สคริปต์เดิมที่ไม่เปลี่ยนแปลงในหลายบัญชี หากสคริปต์ส่งอีเมลรายงาน ผู้รับต้องระบุบัญชีต้นทาง คุณใช้เมธอด getCustomerId()
ของออบเจ็กต์ Account
เพื่อทำสิ่งต่อไปนี้ได้
let accountId = AdsApp.currentAccount().getCustomerId();
MailApp.sendEmail("customer@example.com",
"Report is ready for " + accountId, report);
ออบเจ็กต์ Account
ยังมีเมธอดที่ช่วยให้คุณระบุสกุลเงินและเขตเวลาของบัญชีได้ด้วย
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-06-04 UTC
[[["เข้าใจง่าย","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-06-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."]]],[]]