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 7515139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:42:33+00:00 2026-05-30T00:42:33+00:00

I am grabbing data from a Google spreadsheet through the Google API using cURL

  • 0

I am grabbing data from a Google spreadsheet through the Google API using cURL in PHP. Using a AJAX HTTP request (via jQuery) I can pull all the data in and get it into an array, but since the <content> tag looks like dirty JSON I’m a little stuck.

I would like to be able to reference the data as a JS object, like so:

alert(xml.feed.content.name);

Example Code:

$.ajax({
   type: "GET",
   url: GtargetURL,
   dataType: "xml",
   success: function parseMyXML(xml){
      var Entries = new Array;
      var i = 0;
      $(xml).find("entry").each(function(){
         var content = $(this).find("content").text();
         Entries[i]=content;
         i++;
      });
      var myArray= new Array();
      myArray= Entries[1].split(",");
      alert (myArray[1]); // Result: "test2"
   }        
});

Example XML:

<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gsx=
<entry>
<content type='text'>relativeid: 4, name: test2, type:  teset3, multiples: yes, cat: yes</content>
</entry>
<entry>many more entries...</entry>
</feed>

Thanks for any help you can offer.

For what it’s worth, I am using this URL format for the Google api call:

https://spreadsheets.google.com/feeds/list/KEY-ID-HERE/1/public/basic

I know that I can do a “cell” call instead of a “list” call, but this suits my purposes better.

  • 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-05-30T00:42:36+00:00Added an answer on May 30, 2026 at 12:42 am

    You could do something like this: http://jsfiddle.net/GVUnF/ http://jsfiddle.net/rMMkD/1/ in your loop.

    var jsonLikeString = "name:red, type:blue, multiples:green, cat:brown";
    
    var jsObject = {};
    
    var stringWithoutSpaces = jsonLikeString.split(' ').join('');
    var splitStrings = stringWithoutSpaces.split(",");
    var kvPairArray = [];
    
    for(var i in splitStrings){
        if(splitStrings.hasOwnProperty(i)){     
            var kvPair = splitStrings[i];
            kvPairArray = kvPair.split(":");
            jsObject[kvPairArray[0]] = kvPairArray[1];
    
        }
    }
    alert(jsObject.cat);
    

    Please note that

    var foo = new Array;
    

    is not exactly idiomatic in javascript.
    You should use

    var foo = [];
    

    instead.

    Also, for appending to an array you should use

    foo.push('something');
    

    instead of having a variable i and incrementing it every loop.

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

Sidebar

Related Questions

Trends data from Twitter Search API in JSON. Grabbing the file using: $jsonurl =
I'm grabbing data from a published google spreadsheet, and all I want is the
I have this syntax for grabbing some data from database, I using codeigniter's active
I am grabbing some data from a page using the code below: int clientId
I use curl for grabbing data from sites, but now I need to grab
In order to prevent somebody from grabbing my data easily, I cache data from
I'm interested in grabbing the EPG data from DVB-T streams. Does anyone know of
What's the best method for looping through a table, grabbing all the data in
I'm grabbing lines from a text file and sifting line by line using regular
When I am grabbing data from my table that require permissions, should all the

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.