Search code examples
apiyelp

Retrieving information from Yelp API for Excel file of restaurants


Total API newbie here. I have an Excel file of restaurants in my city. For each restaurant, I have its name, address, city, state, zip code, and coordinates. I would like to retrieve additional information about these restaurants, like their ratings and price levels, and add those variables to my datafile. Is this something I could do through Yelp Fusion API? I've tried googling my question but I am still unclear if this is possible or not. I'm also unsure on how to code this because I only know R and there is very little example code for Yelp Fusion API in R.


Solution

  • The answer to your question is Yes, you can use Yelp Fusion API to pull yelp information relating to those businesses in your excel file.

    With that said, I have no experience with the R language, but I do know it can be done in javascript without using any fancy libraries (except for accessing the Excel file), so my guess is you could probably pull it off with R as well.

    Here is my non-professional-programmer algorithm for solving your problem...

    1. Extract each business from the spreadsheet and place them in a data structure.
    2. Construct the parameters for your API call in JSON format.
    3. Loop through each business and separately send each request to Yelp.
    4. Save each response from the Yelp API to a new data structure, such as an array.
    5. Parse the desired information from each response and then either: 1) add it to your source spreadsheet or 2) combine the existing spreadsheet data with the new yelp data and then save to a new spreadsheet.

    There is probably a better way to do this, but this is the approach I would take.