I have found a script to export my google sheets workbook as .XLXS and email it to an address.
However it is not working when i try and set the name of the .xlxs file to a value in the workbook. code below:
function getGoogleSpreadsheetAsExcel(){
try {
var ss = SpreadsheetApp.getActive();
var name = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Project Details').getRange(2,A).getValue()
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( name + ".xlsx");
MailApp.sendEmail("(i know an email address goes here)", "Tablet Data Import", "The XLSX file is attached", {attachments: [blob]});
} catch (f) {
Logger.log(f.toString());
}
}
Some help would be appreciated