【发布时间】:2022-06-14 04:07:50
【问题描述】:
我找到了这段代码,我可以在其中将 google sheet 下载为 pdf,但我想更改它以便选择另一个工作表,然后选择活动的工作表,并在代码在没有框的情况下运行后下载 pdf。
function PDF() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheetId = ss.getActiveSheet().getSheetId();
var url = "https://docs.google.com/a/mydomain.org/spreadsheets/d/" + ss.getId() + "/export?exportFormat=pdf&gid=" + sheetId + "&access_token=" + ScriptApp.getOAuthToken();
var str = '<input type="button" value="Download" onClick="location.href=\'' + url + '\'" >';
var html = HtmlService.createHtmlOutput(str);
SpreadsheetApp.getUi().showModalDialog(html, "Download_Report");
}
【问题讨论】:
-
我必须为我糟糕的英语水平道歉。不幸的是,我无法理解
I want to change it in order to chose another sheet then the active one and download the pdf once the code run without the box.。可以问一下具体情况吗? -
我的意思是我想在一张纸上运行这段代码,而不是我目前使用的那张
-
感谢您的回复。从你的回复中,我提出了一个答案。你能确认一下吗?如果我误解了您的问题并且没有用处,我深表歉意。