我在日程安排中添加了一个功能,其中我可以发送一个可以复制格式但不复制合并单元格格式的工作表。这是下面的代码:
注意:我将此添加到我的库中= Mo6Ljr7ZKrMeYO9mHqOdo9oxc-w7mEonb [我将其命名为SheetConverter]
//Sending to E-mail----------
//----------
//Convert Sheet to HTML
function convSheetAndEmail(rng, email, subj)
{
var HTML = SheetConverter.convertRange2html(rng);
MailApp.sendEmail(email, subj, '', {htmlBody : HTML});
}
function SendB(){
if (Browser.msgBox('Schedule',"Are you sure you want to send this Schedule? \\n Warning!!! this will send Immediately to the sender", Browser.Buttons.YES_NO) == "yes" ){
var sheet = SpreadsheetApp.getActiveSheet();
var DateRS = sheet.getRange("I14");
var EADDRS = sheet.getRange("I12");
var dataRange = SpreadsheetApp.getActiveSpreadsheet().getRange("A1:F31"); // Fetching the E-mail Content to be Sent
var emailAddress = EADDRS.getDisplayValue(); // Fetching the E-mail Address to be Sent
var subject = "SCHEDULE "+ DateRS.getDisplayValue(); // Setting up the E-mail Subject to be Sent
convSheetAndEmail(dataRange, emailAddress, subject); //Sending Line
}
else{
Browser.msgBox("Ops Checklist", "Send cancelled", Browser.Buttons.OK)
}
}
//Code End here at Sending to E-mail----------
我的代码附带的示例输出: