Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:27:51+00:00 2026-06-13T16:27:51+00:00

I am trying to use Google Apps Script to query the Yelp Search Api

  • 0

I am trying to use Google Apps Script to query the Yelp Search Api and put the results into a spreadsheet. I having issues making the call to yelp using this example as a model:

var consumerKey = "... register your app with Twitter ...";
var consumerSecret = "... register your app with Twitter ...");

var oauthConfig = UrlFetchApp.addOAuthService("twitter");
oauthConfig.setAccessTokenUrl("http://api.twitter.com/oauth/access_token");
oauthConfig.setRequestTokenUrl("http://api.twitter.com/oauth/request_token");
oauthConfig.setAuthorizationUrl("http://api.twitter.com/oauth/authorize");
oauthConfig.setConsumerKey(consumerKey);
oauthConfig.setConsumerSecret(consumerSecret);

// "twitter" value must match the argument to "addOAuthService" above.
var options = {
  "oAuthServiceName" : "twitter",
  "oAuthUseToken" : "always"
};

var url = "http://api.twitter.com/1/statuses/user_timeline.json";
var response = UrlFetchApp.fetch(url, options);
var tweets = JSON.parse(response.getContentText());

// Handle tweets

https://developers.google.com/apps-script/class_oauthconfig

This class only has methods for setting the access token URLs which Yelp doesn’t appear to provide. They just provide the Token and Token Secret directly. I assumed that these would be set like the Consumer Key and Secret but I haven’t found a way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:27:53+00:00Added an answer on June 13, 2026 at 4:27 pm

    The Yelp API uses oAuth1.0a to authorize and identifiy the API caller not the end user that might be using the application. This is not like a Twitter scenario where you have to let your users login. Therefore, you dont need any access token URLs or other details. You are able to create all the necessary tokens to get started. Here is how your API console should look like once everything is setup (I’ve obfuscated my keys for obvious reasons) –

    Yelp API Console

    Now, you’ll need to make the API calls from the server side using UrlFetchApp and not use the jQuery AJAX APIs as that Yelp API doesn’t seem to allow CORS and JSONP is not allowed with HtmlService. Otherwise you’ll get errors like this below in the console –

    Chrome Console

    Lastly, here is some sample code to get you started. I based these off their JavaScript sample –

      var auth = { 
        consumerKey: "YOURKEY", 
        consumerSecret: "YOURSECRET",
        accessToken: "YOURTOKEN",
        accessTokenSecret: "YOURTOKENSECRET",
      };
    
      var terms = 'food';
      var near = 'San+Francisco';
    
      var accessor = {
        consumerSecret: auth.consumerSecret,
        tokenSecret: auth.accessTokenSecret
      };
    
      var parameters = [];
      parameters.push(['term', terms]);
      parameters.push(['location', near]);
      parameters.push(['oauth_consumer_key', auth.consumerKey]);
      parameters.push(['oauth_consumer_secret', auth.consumerSecret]);
      parameters.push(['oauth_token', auth.accessToken]);
    
      var message = { 
        'action': 'http://api.yelp.com/v2/search',
        'method': 'GET',
        'parameters': parameters 
      };
    
      OAuth.setTimestampAndNonce(message);  
    
      OAuth.SignatureMethod.sign(message, accessor);
    
      var parameterMap = OAuth.getParameterMap(message.parameters);
      parameterMap.oauth_signature = OAuth.percentEncode(parameterMap.oauth_signature)
    
      var url = OAuth.addToURL(message.action,parameterMap);
      var response = UrlFetchApp.fetch(url).getContentText();
      var responseObject = Utilities.jsonParse(response);
      //have my JSON object, do whatever we want here, like add to spreadsheets
    

    I also added a couple of GS script files with the contents of the oAuth JS code and SHA1 JS code from the links provided (just copy paste into new files in the script editor). However, if you feel adventurous, you could also use the Utilities APIs to manually sign and encode the necessary oAuth params.

    Hope this helps. I was able to get Yelp responses with all the provided samples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Google's Images API to search an image and put it
I'm trying to use access the google spreadsheet's solver feature from google-apps-script. Does anyone
I'm trying to use Google Analytics API to query internal searches that happen on
I am simply trying to use google apps script code to create a new
I'm actually working with google apps script and I was trying to use a
I've been trying to use oAuth in Google apps script to access trello data,
I am trying to use Google's libjingle framework and need to broadcast a query
I'm trying to use the Google Geocoder API to get me a Latitude and
I'm trying to publish a Google Apps Script form, built with UiApp. So far,
I'm trying to work out if it is possible to use Google Apps Scripts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.