如何在google Sheet脚本中接收参数值并在sql查询中使用参数

时间:2017-10-13 06:11:07

标签: google-apps-script google-sheets

我有以下googleSheet网址:

https://docs.google.com/spreadsheets/d/19D-ApX1M_vuGUVOSIUrxrpyVna6pxBk86abTfmXRzBI/edit#gid=0?empId=1203&DepId=MCA

我想在google sheet url中传递查询字符串参数,并将其用于工作表脚本

我在表脚本中使用此代码

console.log('index created length', this.$store.state.article_list.length) // 0

以上网址只给我

https://docs.google.com/spreadsheets/d/19D-ApX1M_vuGUVOSIUrxrpyVna6pxBk86abTfmXRzBI/edit

我想使用url中的所有参数,如

https://docs.google.com/spreadsheets/d/19D-ApX1M_vuGUVOSIUrxrpyVna6pxBk86abTfmXRzBI/edit#gid=0?empId=1203&DepId=MCA

如何从脚本中的googleSheet获取参数var url = SpreadsheetApp.getActiveSpreadsheet().getUrl(); empId

1 个答案:

答案 0 :(得分:1)

使用Google Apps脚本电子表格服务无法做到这一点。可以通过使用创建Web应用程序和使用事件对象来实现。有关详细信息,请参阅Web Apps