Posted By

vetri02 on 11/11/10


Tagged

beautifulsoup


Versions (?)

Retreive data from google spreadsheet using python and beautiful soup


 / Published in: Python
 

Create a spreadsheet on google doc share it and publish as web page ,take the url and put it instead of the URL pasted here on the code.You can retrieve the column values accordingly by changing the class name on soup.findAll (eg.:'class' : 's1')

  1. import urllib2
  2. from BeautifulSoup import BeautifulSoup
  3.  
  4. page = urllib2.urlopen("https://spreadsheets.google.com/pub?key=0AujzeBNXnyI-dDNBRFJZaTZyRnZnMzdnQlFzSkRsd2c&hl=en&output=html")
  5.  
  6. soup = BeautifulSoup(page)
  7. ted = soup.findAll('td',{ 'class' : 's1'})
  8. for td in ted:
  9. print td.string

Report this snippet  

You need to login to post a comment.