简体   繁体   English

创建动态HTML文件并在Google Apps脚本中执行

[英]create a dynamic html file and execute it in google apps script

I'm trying to migrate various Excel applications to Google Apps. 我正在尝试将各种Excel应用程序迁移到Google Apps。 These generate html and javaScript based on various excel data and parameters to create a local html file which is then opened by a browser. 它们根据各种excel数据和参数生成html和javaScript,以创建本地html文件,然后由浏览器打开。

I know it's a long shot, but can anyone think of a way to mimic this behavior in Google Apps Script? 我知道这是一个漫长的过程,但是没有人能想到一种在Google Apps脚本中模仿这种行为的方法吗? Namely - create a file on the client and fetch it up in a browser session. 即-在客户端上创建一个文件,然后在浏览器会话中将其提取。

Here's an example of the type of application I mean 这是我所指的应用程序类型的示例

You can use DocsListApp.createFile to create new HTML files on the user's Google Drive, but I don't believe you can serve the HTML from Drive directly. 您可以使用DocsListApp.createFile在用户的Google云端硬盘上创建新的HTML文件,但是我认为您不能直接从云端硬盘提供HTML。 Alternatively you can use the SitesApp to create a new page on a Google Site with the HTML you want, using Site.addWebPage . 或者,您可以使用SitesApp通过Site.addWebPage在所需的HTML上在Google网站上创建新页面。 Finally, you may want to look into the widgets available in UiApp or the UI Builder, to see if you can use those instead of custom HTML. 最后,您可能需要研究UiApp或UI Builder中可用的小部件,以查看是否可以使用这些小部件代替自定义HTML。

Just saw this: 刚刚看到了这个:

https://googledrive.com/host/0B716ywBKT84AMXBENXlnYmJISlE/GoogleDriveHosting.html https://googledrive.com/host/0B716ywBKT84AMXBENXlnYmJISlE/GoogleDriveHosting.html

HTML files uploaded to Public Google Drive folder are served as HTML, link is available through "Preview" button. 上载到Public Google Drive文件夹的HTML文件以HTML形式提供,可通过“预览”按钮获得链接。

So far it doesn't work with Google Drive files simply moved to that folder but perhaps would work with files created there via createFile script. 到目前为止,它仅适用于仅移动到该文件夹​​的Google云端硬盘文件,但可能不适用于通过createFile脚本在此处创建的文件。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM