functiononOpen() {
// add menu to menubar
constui=DocumentApp.getUi();
ui.createMenu("Tapadoo Templates")
.addItem("Test Report", "testReport") // add drop-down for specific templated
.addToUi();
}
functiontestReport() {
// get real Cloudflare service auth key for headers
constresponse=UrlFetchApp.fetch("https://templates.tapadoo.com/testing_status_report.html", {
"headers": {
"CF-Access-Client-Id":"7df0...access",
"CF-Access-Client-Secret":"70db...ea97" }
});
// get HTML text
consthtml=response.getContentText();
// convert to a format that can be inserted into a document
constblob=HtmlService.createHtmlOutput(html).getBlob();
// get the current document
constdoc=DocumentApp.getActiveDocument();
// insert the blog contents into the doc
Drive.Files.update("", doc.getId(), blob);
}