我有一个电子表格,我想使用Google App脚本自动发送带有附件的电子邮件,这是.XLSX文件中电子表格的其中一张。我可以使用下面显示的代码来完成此操作,但是我不知道如何发送仅包含“ A”到“ F”列的表单。我已经搜索过,但仍然找不到方法,所以请帮助我。谢谢
function getSheetID(name){
var ss = SpreadsheetApp.getActive().getSheetByName(name)
var sheetID = ss.getSheetId().toString()
return sheetID
}
function getGoogleSpreadsheetAsExcel(){
var ss = SpreadsheetApp.getActive();
var shID = getSheetID("SHE");
var url = "https://docs.google.com/spreadsheets/d/" + ss.getId() + "/export?format=xlsx&gid="+shID;
var params = {
method : "get",
headers : {"Authorization": "Bearer " + ScriptApp.getOAuthToken()},
muteHttpExceptions: true
};
var blob = UrlFetchApp.fetch(url, params).getBlob();
blob.setName("SHE.xlsx");
MailApp.sendEmail("test@gmail.com", "Test send only one sheet of whole spreadsheet", "Hi Ted, I", {attachments: [blob]});
}