LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Wednesday, September 20, 2023

Creating HTML with Google Apps Script(createHtmlOutputFromFile)


This is an example of code that creates a simple HTML page with Google Apps Script's HtmlService.createHtmlOutputFromFile().


The output HTML page will be as follows.


The script editor will look like this:


Code.gs
function doGet() {
return HtmlService.createHtmlOutputFromFile('index').setTitle("Title");
}


index.html
<!DOCTYPE html>
<html>
<head>
<style>
textarea {
width: 80vw;
height: 80vh;
font-size: 15px;
}
</style>
</head>
<body>
<textarea></textarea>
<script>
myFunction();
function myFunction() {
console.log("This is a log message.");
}
</script>
</body>
</html>


Reference

HTML Service: Create and Serve HTML


Related pages

Latest post

スプレッドシートA列にある複数のテキストをスライドに追加したい(Google Apps Script)

今回Google Apps Scriptでやりたいこと GoogleスプレッドシートA列にある複数の値を取得して Googleスライドに渡して 図形オブジェクトのテキストとして追加したい ① スプレッドシートのA列に値を入れておく ② Code.gsのinsertNewShape...