Import google sheets via G script

Tagged:

Currently contains 2 posts

Avatar

March 15, 2020 12:34

Steven Falivene

I am trying to import into google sheets via the script. I have my keys and ID. It fails on the fetch with teh message.

Exception: Invalid argument: https://api.weatherunlocked.com/api/forecast/au.3500?app_id={???}&app_key={?????????}

Even when I put the URL in the web browser it says

Authentication or authorization failed. Please check your keys, plan limits or if your plan includes access to the data you are trying to request.

The g script code is below (same script works for dark sky API), what is wrong and how do I get it to import JSON?

var url = ‘https://api.weatherunlocked.com/api/forecast/au.3500?app_id={????}&app_key={????????}’; // weatherunlocked

//THE GOOGLE SHEETS STUFF var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); var response = UrlFetchApp.fetch(url); Browser.msgBox(response);

Avatar

March 16, 2020 02:02

Steven Falivene

I found the problem. In the example it put curly braces around the ID and the key, I discovered that these curly braces need to be omitted ; no curly braces in url!

Reply to thread
  1. If you're human, leave this field empty.