I want to send out only one tab of a specific sheet by Outlook mail using Google App script in Google Spreadsheet.
I searched and wrote the script, but it is too old to work or an error occurs.
What i want Among the multiple tabs of the List sheet of the spreadsheet, the data from sheet 33 to column A1:M are saved as "values" in .xls and attached to Outlook mail and sent
And how do I add a day to today's date in new Date()?
If there is an expert who can help me, it would be a great help.
Thanks.
function sendEmail(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet=ss.getSheetByName("Sheet33");
var url = "https://docs.google.com/feeds/download/spreadsheets/Export?key=" + ss.getSheetName() + "&exportFormat=xlsx";
var d = Utilities.formatDate(new Date(), "GMT+9", "yyyyMMdd");
var token = ScriptApp.getOAuthToken();
var response = UrlFetchApp.fetch(url, {
headers: {
'Authorization': 'Bearer ' + token
},
muteHttpExceptions: true
});
var blobs = [response.getBlob().setName(ss.getSheetName() + ".xlsx")];
var receipient = "khan@abc.com"
var subject = "Date_"+ d + ss.getSheetName() +" List share."
var emailbody = "Date_"+ d + ss.getSheetName() +" List share.\nThanks."
MailApp.sendEmail(receipient, subject, emailbody, {attachments: blobs});
Browser.msgBox("Date_"+ d + ss.getSheetName() + " Send Mail Complete.", Browser.Buttons.OK);
}```