Apps Scriptリファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary

2023年9月20日水曜日

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

Google Formsのフォントや色をカスタマイズしたい(UI操作)

Googleフォームではテーマをカスタマイズしてヘッダー画像や色やフォントを設定できます 今回は  Google Formsで単一選択の質問を作りたい  で作ったフォームをベースに テーマをカスタマイズしていきます テーマをカスタマイズ フォームの編集画面で上部メニューから「テー...