我们使用AskNicely通过发送调查并使用从响应中获得的数据来衡量我们的绩效来确定我们的NetPromoter得分。然后,我们将响应拉出,并从下面获取示例JSON数据:
{
"success": true,
"total": "14836",
"totalpages": "2968",
"pagenumber": "1",
"pagesize": "50000",
"since_time": "0",
"data": [
{
"response_id": "20352",
"person_id": "11007",
"name": "Mark Williams",
"email": "markwilliams_23@hotmail.com",
"answer": "5",
"answerlabel": "5",
"data": null,
"comment": "Response time is too long. But was able to resolve my issue",
"note": null,
"status": "",
"dontcontact": null,
"sent": "2018-10-03 08:53:21",
"opened": "2018-10-03 08:53:21",
"responded": "2018-10-03 09:21:30",
"lastemailed": "2018-10-03 08:53:21",
"created": "2018-10-03 08:53:02",
"segment": "",
"published": "",
"publishedname": "-",
"publishedavatar": null,
"customernumber_c": "171502",
"companyname_c": "Williams, Mark",
"agentname_c": "MICHAEL S",
"city_c": "RIDGEHAVEN",
"segment_b_c": null,
"state_c": "SA",
"workflow_custom_alerts_c": null,
"workflow_check_for_publish_c": null,
"workflow_detractor_alerts_c": null,
"company_c": null,
"segment_a_c": null,
"deliverymethod": "email",
"dashboard": "recommend",
"email_token": "568e62f94c"
},
{
"response_id": "20351",
"person_id": "11006",
"name": "Susie White",
"email": "Whites61@bigpond.net.au",
"answer": "9",
"answerlabel": "9",
"data": null,
"comment": "Best service i've gotten so far!",
"note": null,
"status": "",
"dontcontact": null,
"sent": "2018-10-03 08:53:21",
"opened": "2018-10-03 08:53:21",
"responded": "2018-10-03 08:53:21",
"lastemailed": "2018-10-03 08:53:21",
"created": "2018-10-03 08:53:02",
"segment": "",
"published": "",
"publishedname": "-",
"publishedavatar": null,
"customernumber_c": "171382",
"companyname_c": "White, Susie",
"agentname_c": "SAM N",
"city_c": "Magill",
"segment_b_c": null,
"state_c": "SA",
"workflow_custom_alerts_c": null,
"workflow_check_for_publish_c": null,
"workflow_detractor_alerts_c": null,
"company_c": null,
"segment_a_c": null,
"deliverymethod": "email",
"dashboard": "recommend",
"email_token": "e257aab272"
},
我可以使用以下脚本成功提取数据:
function callAPI() {
// Call the Numbers API for random math fact
var response = UrlFetchApp.fetch("insert URL");
var a = response.getContentText();
Logger.log(a);
}
但这就是我的知识范围。我需要的是将“数据”中的每个项目拉出,并使标签成为第1行中的表标题,然后将它们的值每行拉出并粘贴。我一直在搜索stackoverflow和google,但到目前为止,我所看到的是仅获取1层数据的脚本。有人可以将我路由到正确的资源吗?