简体   繁体   English

如何读取应用脚本项目中的另一个文件?

[英]How do i read another file inside the app script project?

I have this email_template.html file in my project and I don't know how to access it.我的项目中有这个 email_template.html 文件,但我不知道如何访问它。 I want to read the content as a string so that I can parse it.我想将内容作为字符串读取,以便解析它。

在此处输入图像描述

you can get html as string like this:你可以得到 html 作为这样的字符串:

const template = HtmlService.createTemplateFromFile("email_template");
const htmlOutput = template.evaluate();
const contentString = htmlOutput.getContent();
Logger.log(contentString);

Then you can parse contentString.然后你可以解析 contentString。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 java 脚本文件中调用 function 在另一个 function 内? - How do I call a function inside of another function from java script file in html file? 如何在另一个html文件中包含html文件 - How do I include html file inside another html file 如何为 html 文件内的内联脚本生成源映射? - How do I generate a sourcemap for an inline script inside of a html file? 如何导出 function 以在另一个文件脚本中调用 - How do I export a function to be called in another file script 如何找到文件读取的谷歌应用脚本限制 - how do I find the google app script limit to file reads 如何读取 Wordpress 元素中存在的值并在脚本中使用它? - How do I read a value existing inside a Wordpress element and use it in a script? 通过 javascript,如何将一个 div 添加到我的 html 脚本中,其中包含另一个 div? - Through javascript, how do I add a div to my html script with another div inside of it? 如何在我自己的 jsx 文件中的脚本文件中访问 object? - How do I access the object inside a script file within my own jsx file? 如何从另一个HTML文件中的一个HTML Apps脚本文件获取JSON数据? - How do I get JSON data from one HTML Apps Script file in another HTML file? 如何从 Javascript/Google App 脚本中的另一个函数调用数组 - How do I call an array from another function in Javascript/ Google App script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM