?
Solved

How to interpret google docs gdata atom.Content in python

Posted on 2011-02-17
4
Medium Priority
?
590 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
[X]
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
  • 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

The really strange introduction Once upon a time there were individuals who intentionally put the grass seeds to the soil with anticipation of solving their nutrition problems. Or they maybe only played with seeds and noticed what happened... Som…
Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
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 modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 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