我正在处理某些事情,当我使用URLfetchApp时 当我运行该程序时,它说“请求失败”并返回代码500。
这是我的代码:
var ss = SpreadsheetApp.openById("1zTdSwuZX1oY6_wBqHjlzSkNkTA8Zopa6DQ0OkkTofH0");
var url = "https://docs.google.com/spreadsheets/d/SS_ID/export?".replace("SS_ID", ss.getId());
var url_ext = 'exportFormat=pdf&format=pdf' // export as pdf / csv / xls / xlsx
+ '&size=letter' // paper size legal / letter / A4
+ '&portrait=false' // orientation, false for landscape
+ '&fitw=true&source=labnol' // fit to page width, false for actual size
+ '&sheetnames=false&printtitle=false' // hide optional headers and footers
+ '&pagenumbers=false&gridlines=false' // hide page numbers and gridlines
+ '&fzr=false' // do not repeat row headers (frozen rows) on each page
+ '&gid='; // the sheet's Id
var token = ScriptApp.getOAuthToken();
var sheets = ss.getSheets();
var folder = DriveApp.getFolderById("0Bw9Go3RUhtd0UW1RY1M3NE1OUmM");
var blobs = [];
var params = { headers: { 'Authorization': 'Bearer ' + token }};
for (var i=0; i<sheets.length; i++) {
// Convert individual worksheets to PDF
var response = UrlFetchApp.fetch(url + url_ext + sheets[i].getSheetId(), params);
blobs[i] = response.getBlob().setName(sheets[i].getName() + '.pdf');
folder.createFile(blobs[i]);
}
请帮帮我:)。