I'm new here (in fact, i'm just starting to learn about coding myself) so I'm sorry if i asked stupid question. I'm trying to learn to code using google Appscript by following tutorial but somehow everything produced an error. here's the code in code.gs:
function doGet(request) {
return HtmlService.createTemplateFromFile('page')
.evaluate();
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename).getContent();
}
both produced an error, the doGet produced SyntaxError: Unexpected token '='
while the include function produced Exception: Bad value
i really don't know where i went wrong, i even copy pasted these from their documentation
edit: fixed the 1st error thanks to the answer, but the second error remains. here's the html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<!-- Icon -->
<link href="https://cdn.lineicons.com/2.0/LineIcons.css" rel="stylesheet">
<?!=include("page-css"); ?>
</head>
<body>
<h1>Well, Hello There!</h1>
</body>
</html>
(the 1st error was because i wrote
<?! = include("page-css"); ?>
instead of
<?!=include("page-css"); ?>
also, the page-css is still empty,
<style>
</style>
i wrap it in because i can't make .css file in google appscript
Update:
i tried to run the function in the appscript (that play button) and it produce exception : bad value @ line 7 (the return HtmlService line). but when i tried to test deployment, it works the way i expected it to be.
pagemight have the issue. So, can you provide your current HTML ofpage? - Tanaike