Hello, Hope for somebody in community can help me with appscript. I have this part well running code and it sends mails. But attached *.xlsx file includes all sheets from initial file and I want to send only 1 exact sheet, ignoring others. Please advice me, where I should state sheet name.
function Mail_excel(){
try {
var ss = SpreadsheetApp.getActive();
var url = “https://docs.google.com/feeds/download/spreadsheets/Export?key=” + ss.getId() + “&exportFormat=xlsx”;
var params = {
method : “get”,
headers : {“Authorization”: "Bearer " + ScriptApp.getOAuthToken()},
muteHttpExceptions: true
};
var blob = UrlFetchApp.fetch(url, params).getBlob();
blob.setName(ss.getName() + “.xlsx”);
MailApp.sendEmail(“usermail@mailbox.com”, “Google Sheet to Excel”, “The XLSX file is attached”, {attachments: [blob]});
} catch (f) {
Logger.log(f.toString());
}
}