0

I faced a problem: at the output I need to get xlsx for printing in landscape mode.
Conversion of gheet to xlsx is normal, however, when printed, it is in portrait mode. portrait=false has no effect. Someone faced with such?

function t(id) {

    var url = "https://docs.google.com/feeds/download/spreadsheets/Export?key=" + id + "&portrait=false&&exportFormat=xlsx";

    var response = UrlFetchApp.fetch(url, { headers: { Authorization: "Bearer " + ScriptApp.getOAuthToken() }, muteHttpExceptions: true });

    return DriveApp.createFile(response.getBlob()).setName("t.xlsx").getId();

}
  • I think you normally would define portrait or landscape in the printing options? I'd suggest to transform it to a PDF. [Look at this other SO question](https://stackoverflow.com/questions/21997924/export-or-print-with-a-google-script-new-version-of-google-spreadsheets-to-pdf) – Casper Feb 19 '18 at 17:31
  • Thanks, I looked at this question. With pdf, everything works correctly, but with xlsx why is it so not working – Митя Воронцов Feb 19 '18 at 18:27

0 Answers0