简体   繁体   中英

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

My URL has quotes char
Example
http://SomeAPIULR?{"Type": "SomeType"}&APIKEY=key

When I remove from the URL {"Type": "SomeType"} the script works perfect

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().

Thanks everyone for the comments!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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