如何将数据包含在Google Apps脚本网络应用的网址中以供阅读? [英] How to include data in a URL for a Google Apps Script web app to read?
问题描述
我制作了我的第一个小测试网络应用程序,并使该技术工作,如下所示:
下一步是让客户能够点击电子邮件中的状态URL,以便他们查看其作业的计划状态。所以,问题:
是否可以创建一个URL,然后webapp可以解析并提取数据?
'p>一个URL是这样的:
https://script.google.com/a/macros/example.com/s/AKfycbwMgBLtVP8Ur8GKNpGxxjna_zr5BlegmvlFqXQW1g6q5UfksAg/exec/ 的 + 123 + +样品街道+ samplesuburb 强>
,然后网络应用程序将拉取并显示与该地址相关的计划信息。
非常感谢〜
您可以检查doGet()函数的'e'对象以获取URL参数。
// yourUrl / A = 1&安培; b = 2和C = 3和C = 4
函数的doGet(E){
e.queryString //将是a = 1& b = 2& c = 3& c = 4
e.parameter; //将是{a:1,b:2,c:3}。对于具有多个值的参数,这只返回第一个值
e.parameters; //将是{a:[1],b:[2],c:[3,4]}。返回每个键的值数组。
}
请参阅网址参数'部分 https://developers.google.com/apps-script/guides/web
I've made my first little test web app and have that "technology" working, as per:
The next step is to enable a customer to be able to click on a status URL in an email so they can view the scheduling status of their job. So, the question:
Is it possible to create a URL which the webapp can then parse and pull data for?
A URL something like: https://script.google.com/a/macros/example.com/s/AKfycbwMgBLtVP8Ur8GKNpGxxjna_zr5BlegmvlFqXQW1g6q5UfksAg/exec/+123+sample+street+samplesuburb
and then the web app would pull and display the scheduling info related to that address.
Many thanks ~
You can inspect the 'e' object of the doGet() function to get URL parameters
// yourUrl/?a=1&b=2&c=3&c=4
function doGet(e){
e.queryString // will be a=1&b=2&c=3&c=4
e.parameter; // will be {"a": "1", "b": "2", "c": "3"}. For parameters that have multiple values, this only returns the first value
e.parameters; // will be {"a": ["1"], "b": ["2"], "c": ["3", "4"]}. Returns array of values for each key.
}
See 'URL parameters' section here https://developers.google.com/apps-script/guides/web
这篇关于如何将数据包含在Google Apps脚本网络应用的网址中以供阅读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!