Convert google spreadsheet to xls in google script

2019-02-17 22:12发布

Possible Duplicate:
Google apps script to email google spreadsheet excel version

I looked everywhere for this but cannot get it to work. I am sending an email with an attachment in google app script. The document is a google spreadsheet. It currently sends as a pdf, however, I would like it to send as a xls. When I run the below code, I get "Unsupported Conversion requested". How can I send it as an xls?

function practiceMail() {

var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveRange();
var file = DocsList.getFileById(docID);
var attachment = file.getAs('application/vnd.ms-excel');
var myFile = [file];

MailApp.sendEmail(email, subject, body, {attachments:myFile, mimetype:application/vnd.ms-  excel });
}

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-02-17 22:58

Please see this question for an explanation. In short, the answer is no. You cannot do this. However, there is an open issue which you can star to request this feature.

查看更多
登录 后发表回答