Google apps script 将网页另存为Google文档(或PDF)以驱动
有没有办法在硬盘中保存网页、谷歌文档或PDF 使用:Google apps script 将网页另存为Google文档(或PDF)以驱动,google-apps-script,save,drive,Google Apps Script,Save,Drive,有没有办法在硬盘中保存网页、谷歌文档或PDF 使用: var response = UrlFetchApp.fetch(url); DriveApp.createFile(response.getBlob()).setName("fileName"); 我已经能够获取HTML内容,并将其保存在驱动器中的文件中,但它将保存包含HTML代码的文档,而不是intepreted web页面呈现 有什么已知的方法可以做到这一点吗 谢谢。我在这个问题中找到了答案: 按照我自己的开始,代码是: var re
var response = UrlFetchApp.fetch(url);
DriveApp.createFile(response.getBlob()).setName("fileName");
我已经能够获取HTML内容,并将其保存在驱动器中的文件中,但它将保存包含HTML代码的文档,而不是intepreted web页面呈现
有什么已知的方法可以做到这一点吗
谢谢。我在这个问题中找到了答案: 按照我自己的开始,代码是:
var response = UrlFetchApp.fetch(url);
var htmlBody = response.getContentText();
var blob = Utilities.newBlob(htmlBody, 'text/html').getAs('application/pdf').setName('fileName.pdf');
DriveApp.createFile(blob);
谢谢,并为这个双重问题道歉,真的很难找到答案。我在这个问题中找到了答案: 按照我自己的开始,代码是:
var response = UrlFetchApp.fetch(url);
var htmlBody = response.getContentText();
var blob = Utilities.newBlob(htmlBody, 'text/html').getAs('application/pdf').setName('fileName.pdf');
DriveApp.createFile(blob);
谢谢,并为这个双重问题道歉,真的很难找到