Gantt screenshot using GAS

Hi @LeventK ,

Thanks for the GAS post !! As we don’t have Gantt view yet , you think GAS can take a screenshot of a gantt living in a google sheet or smartsheet or excel at interval? To simplify, I use www.google.com first. I have copied and pasted the following into the script editor but it did not work:

var siteUrl = “http://www.google.com”;
var url = “https://www.googleapis.com/pagespeedonline/v4/runPagespeed?screenshot=true&fields=screenshot&url=” + encodeURIComponent(siteUrl);
var res = UrlFetchApp.fetch(url).getContentText();
var obj = JSON.parse(res);
var blob = Utilities.newBlob(Utilities.base64DecodeWebSafe(obj.screenshot.data), “image/png”, “sample.png”);
DriveApp.createFile(blob);


it says:
Exception: Request failed for https://www.googleapis.com returned code 404. Truncated server response: Not Found (use muteHttpExceptions option to examine full response) (line 3, file “Code”)

DetailsDismiss


The code posted on the internet that I copied from is:

var siteUrl = “### URL you want to retrieve a screen shot. ###”;
var url = “https://www.googleapis.com/pagespeedonline/v4/runPagespeed?screenshot=true&fields=screenshot&url=” + encodeURIComponent(siteUrl);
var res = UrlFetchApp.fetch(url).getContentText();
var obj = JSON.parse(res);
var blob = Utilities.newBlob(Utilities.base64DecodeWebSafe(obj.screenshot.data), “image/png”, “sample.png”);
DriveApp.createFile(blob);

Cheers!
Jerry