Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to interpret google docs gdata atom.Content in python

Posted on 2011-02-17
4
587 Views
Last Modified: 2012-05-11
I am trying to import data from a google spreadsheet and programatically create objects from it.  I have been able to see the data but cant understand how to process each filed.  I have attached the code I have so far.

How do I access the fields of data and create objects from them.  It looks like a dictionary object but I cant read the fields by name.


import gdata
import gdata.spreadsheet.service
import gdata.docs.service
import atom.core

gd_client = gdata.spreadsheet.service.SpreadsheetsService()
gd_client.email = 'firstname.lastname@gmail.com'
gd_client.password = 'password'
gd_client.source = 'my-exporter-1'
gd_client.ProgrammaticLogin()

key = 'biglongggoledockey'

def ListGetAction(gd_client, key, wksht_id):
  # Get the list feed
  feed = gd_client.GetListFeed(key, wksht_id)
  for line in feed.entry:
      print line.content.text

Open in new window

0
Comment
Question by:Aaran_Stent1
  • 3
4 Comments
 
LVL 16

Expert Comment

by:Kalpesh Chhatrala
ID: 34923698
0
 

Author Comment

by:Aaran_Stent1
ID: 34930087
i have spent a long time reading the api.  i just need a example of how to iterate through  the atom feed/content please.
0
 

Accepted Solution

by:
Aaran_Stent1 earned 0 total points
ID: 34930697
Found the solution i was looking for...

http://gdatatips.blogspot.com/2008/07/access-spreadsheets-list-feed-elements.html


# print out dictionary of row information for each row  
for entry in worksheet_list_feed.entry:  
  for key in entry.custom:  
    print '%s: %s' % (key, entry.custom[key].text)

Open in new window

0
 

Author Closing Comment

by:Aaran_Stent1
ID: 34959273
I searched for the spreadsheet object and found the example rather than the atom content object i was looking at
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl Frameworks 1 98
Need To Find FireFox Binary Path For Python Selenium On Windows 7 15 716
Ptyhon Dex.txt how to use this regex for this python script? 40 96
phython 2 19
Here I am using Python IDLE(GUI) to write a simple program and save it, so that we can just execute it in future. Because when we write any program and exit from Python then program that we have written will be lost. So for not losing our program we…
Flask is a microframework for Python based on Werkzeug and Jinja 2. This requires you to have a good understanding of Python 2.7. Lets install Flask! To install Flask you can use a python repository for libraries tool called pip. Download this f…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question