1

Google Sheets with RapidAPI

First time trying to get APIs to work! I thought a simple project would be to get a Googlesheet to retrieve movie information based on the title.

Googling around I happened upon RapidAPI which has a Googlesheets add-on. Unfortunately I haven't found much useful documentation so have hit a dead end.

What I've learned so far

There only seems to be one example for how to implement it... by using the =GET() command like so (in this case for pulling finance info):

=GET(”https://investors-exchange-iex-trading.p.rapidapi.com/stock/{symbol}/book”,”quote.companyName”,”YOUR_API_KEY_HERE”,”symbol”,”AAPL”)

I couldn't get this example to work, and the IMDB Code Snippet seems a little different, so I'm not sure how that works at all. Not the curly bracers around {symbol}.

var axios = require("axios").default;

var options = {
  method: 'GET',
  url: 'https://imdb8.p.rapidapi.com/title/find',
  params: {q: 'Dredd'},
  headers: {
    'x-rapidapi-host': 'imdb8.p.rapidapi.com',
    'x-rapidapi-key': '5840855726msh193dee7e1600046p145eddjsnc66aff778896'
  }
};

axios.request(options).then(function (response) {
    console.log(response.data);
}).catch(function (error) {
    console.error(error);
});

When I run a typical search on IMDB, I get a URL that looks like this:

https://www.imdb.com/find?q=dredd&ref_=nv_sr_sm

I notice this q parameter there, which seems important...

  • I'm not sure how I am meant to format this =GET() command for IMDB data. The example suggests one thing, but Googlesheets suggests another: "GET(url, selectPaths, rapidApiKey)"
  • I'm not sure what the curly bracers are doing in the example URL.
  • Whatever I try seems to give the same error message:

Error Request failed for https://imdb8.p.rapidapi.com returned code 400. Truncated server response: 400 - Bad Request (use muteHttpExceptions option to examine full response) (line 98).

Send Help

Does anyone have a better, working tutorial for using this setup? Or could you direct me to some useful reading material that a layperson could understand?

player0
  • 124,011
  • 12
  • 67
  • 124
HotSauceCoconuts
  • 301
  • 5
  • 19
  • I have to apologize for my poor English skill. Unfortunately, I cannot understand your question. In your goal, you want to retrieve the values using axios? If my understanding is correct, I cannot understand the relationship between your script and Google Spreadsheet. Can I ask you about the detail of your goal? – Tanaike Oct 13 '21 at 22:44
  • The RapidAPI Googlesheets extension can use some of the information in this axios code snippet to pull data from the API. But I can't get it to work. – HotSauceCoconuts Oct 13 '21 at 22:57
  • Thank you for replying. From your replying, I have to apologize for my poor English skill again. Unfortunately, I cannot still understand your question. But I would like to try to understand it. When I could correctly understand it, I would like to try to think of the solution. – Tanaike Oct 13 '21 at 22:59
  • 1
    Try `UrlFetch()` directly. See documentation. And use `muteHttpExceptions:true` as a `param` – TheMaster Oct 14 '21 at 07:18
  • 1
    Could you expand on that? Is there any detailed documentation for this? I couldn't find anything for using in specifially in Googlesheets. Also, how might I employ the use of this param? – HotSauceCoconuts Oct 15 '21 at 14:39
  • 1
    See [tag info page](https://stackoverflow.com/tags/urlfetch/info) for documentation. You'll be using `UrlFetchApp.fetch(url, params)` in tools> script editor(where params would include `headers`(with api keys), `payload` and `muteHttpExceptions`). Also check your rapid api dashboard for error details(400) – TheMaster Oct 15 '21 at 15:13

1 Answers1

1

I found a good resource for you. Check out this well-written article on RapidAPI's official blog.

https://rapidapi.com/blog/api-google-sheets/

Pratham
  • 497
  • 3
  • 7