简体   繁体   English

使用Google表格从带有引号的URL导入数据

[英]Import data from an URL with quotes using google sheets

I'm using a script called "ImportJSON" created by paulgambill https://gist.github.com/paulgambill/cacd19da95a1421d3164 我正在使用由paulgambill https://gist.github.com/paulgambill/cacd19da95a1421d3164创建的名为“ ImportJSON”的脚本

My URL has quotes char 我的网址带有引号char
Example
http://SomeAPIULR?{"Type": "SomeType"}&APIKEY=key

When I remove from the URL {"Type": "SomeType"} the script works perfect 当我从URL {“ Type”:“ SomeType”}中删除该脚本时,它可以完美运行

function ImportJSONAdvanced(url, query, options, includeFunc, transformFunc) {
  var jsondata = UrlFetchApp.fetch(URL);
  var object   = JSON.parse(jsondata.getContentText());

  return parseJSONObject_(object, query, options, includeFunc, transformFunc);
}

Any how to make this work? 任何如何使这项工作?

I was able to do it Using encodeURI(). 我能够使用encodeURI()做到这一点。

Thanks everyone for the comments! 多谢大家的评价!

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

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