r/GoogleAppsScript • u/notquitehuman_ • Mar 25 '26
Question Include instructions being ignored.
Hi all,
Not sure what's going wrong, but here goes.
I'm making a wizard for a button function in google sheets. In my html file, I try to include wizard.js and wizard.css
they never end up working properly. i have confirmed (with console outputs) that the <script> and <style> tags that hold the <include?!=> are being ignored completely.
debug lines before and after the <script> tag fire. debug lines inside the <script> tag fail.
separate console outputs in their own <script> tag still fire, so it's not the case that all <scripts> are being stripped. templating is working as intended.
is there a wierd quirk with app scripts that I should know about?
Edit to add: I originally had a project that was working. After some edits it suddenly stopped accepting the includes. I restarted the entire process when I first hit this issue, and am now running into it again.
View all comments
Show parent comment
1
u/notquitehuman_ Mar 25 '26
This is in my Code.gs:
function include(filename) { return HtmlService.createHtmlOutputFromFile(filename).getContent(); }
function openWizard(caseType) { const template = HtmlService.createTemplateFromFile("wizard"); template.caseType = JSON.stringify(caseType); template.headerInfo = JSON.stringify(getHeaderInfo(caseType)); }
and my html is
<style> <?!= include('wizard.css'); ?> </style>
(inside <head> tags)
<script> <?!= include('wizard.js'); ?> </script>
(inside <body> tage)
(I have also tried ommitting the script/style tags and including a html file instead, whose sole purpose is to wrap and include the .js and .css)
And yes, caseType is definitely being passed correctly.