首页 > 解决方案 > 我可以将 Google 表格单元格下载为 JS 文件吗?

问题描述

如果我的 Google 工作表如下所示:

    A           B               C                               D
1   Template    {content}       document.write('{content}')
2
3   Name        Value           Output                          Button
4   Test        A test          =SUBSTITUTE(c$1, b$1, B4)       [A button with a custom function...]
5   Dummy       Just a dummy    =SUBSTITUTE(c$1, b$1, B5)       [A button with a custom function...]
6   Foo         Foo this        =SUBSTITUTE(c$1, b$1, B6)       [A button with a custom function...]
7   Bar         Bar that        =SUBSTITUTE(c$1, b$1, B7)       [A button with a custom function...]

我可以使用自定义函数让每个按钮将其相关单元格下载为 JS 文件吗?例如,点击 D4 应该将 C4 保存为 {A4}.js(即 Test.js),这样 Test.js 将包含:

document.write('A test')

标签: google-apps-scriptgoogle-sheetsdownload

解决方案


推荐阅读