0
我有一張隱藏的工作表,用於確定通過電子郵件發送的人。我現在擁有的腳本不會在沒有打開表單的情況下運行。是否有可能運行該GAS而不必取消隱藏表格?如何在隱藏表格上運行Google Apps腳本
function sendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange(1,3);
var email = range.getValues();
var emailAddress = email[0][0];
var range = sheet.getRange(2,3); // Fetch the range of cells E1:E1
var CC = range.getValues();
var ccEmail = CC[0][0];
var range = sheet.getRange(3,3); // Fetch the range of cells E2:E2
var subject = range.getValues(); // Fetch value for subject line from above range
var EmailSubject = subject[0][0];
var range = sheet.getRange(5,4);
var message = range.getValues();
var messageBody = message[0][0];
MailApp.sendEmail({ to: emailAddress, cc: ccEmail , subject: EmailSubject, body: messageBody, });
}
也許你可以簡單的使用showSheet()方法,這使得表可見,然後執行你想要做什麼操作。對於ref:https://developers.google.com/apps-script/reference/spreadsheet/sheet#showSheet() – KRR 2015-04-02 22:36:51