Converting spread sheet to PDF works awesome! but not for exel sheet.
My code: **converting spread sheet to PDF .. working great! :) **
var pdf2 = DriveApp.getFileById(newSpreadsheet2.getId()).getAs('application/pdf').getBytes();
var attachPdf = {fileName:'WeeklyPdfStatus.pdf',content:pdf2, mimeType:'application/pdf'};
// Send the freshly constructed email
MailApp.sendEmail("<my_MailID>@gmail.com", subject, message, {attachments:[attachPdf]});
MailApp.sendEmail("elango.vb@gmail.com", subject, message, {attachments:[attachPdf]});
My code: **converting spread sheet to Excel format .. did NOT work :( **
var exl = DriveApp.getFileById(newSpreadsheet2.getId()).getAs('application/xls').getBlob();
var attachExl = {fileName:'WeeklyExcelStatus.xls',content:exl, mimeType:'application/xls'};
// Send the freshly constructed email
MailApp.sendEmail("<my_MailID>@gmail.com", subject, message, {attachments:[attachExl]});
I know I'm missing something basic, can some one please explain what should I change/modify so that I can get my data as excel itself?
Please help!!
Thanks in advance...