Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 将网页另存为Google文档(或PDF)以驱动_Google Apps Script_Save_Drive - Fatal编程技术网

Google apps script 将网页另存为Google文档(或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

有没有办法在硬盘中保存网页、谷歌文档或PDF

使用:

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);
谢谢,并为这个双重问题道歉,真的很难找到