Is there a way to save a web page, to a Google Document, or a PDF in Drive?
Using:
var response = UrlFetchApp.fetch(url);
DriveApp.createFile(response.getBlob()).setName("fileName");
I have been able to get the HTML content, and save it in a file in Drive, but it will save a document containing the html code, not the intepreted web page render.
Is there any known way to do this?
Thanks.
I found the answer in this question: Using HTML file to output a PDF.
Following my own start, the code would be:
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);
Thanks, and apologies for the double question, it was really hard to find.