Introduction
Retreive data from google spreadsheet using python and beautiful soup

Retreive data from google spreadsheet using python and beautiful soup

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′)

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

Vetrichelvan Jeyapalpandy

12 years of experience in web development. Javascript enthusiast. Performance is an important trait of any website, so trying to improve that wherever possible.

View Comments
Next Post

Twitter feed on Python using YQL and BeautifulSoup