On May 19, 5:12 am, Terry Reedy <tjre...@udel.edu> wrote:
> Kalyan Chakravarthy wrote:
> > Hi All,
> >              I have data in Spread Sheet ( First Name and Last Name),
> > how can i see  this data  in Python code ( how can i use Spread Sheet as
> > Data Store ) .
>
> I you have a choice, a plain text file is MUCH easier.

for line in open('guff.txt'):
    first, last = line.rstrip('\n').split('\t')

> Or, you can output a plain text data.csv (comma-separated variable) file
> from the spreadsheet and read that with the csv module.

import csv
for row in csv.reader(open('guff.csv', 'rb')):
    first, last = row

Or, if you have an Excel XLS file, use xlrd:

import xlrd
book = xlrd.open_workbook('guff.xls')
sheet = book.sheet_by_index(0)
for rowx in xrange(sheet.nrows):
    first, last = sheet.row_values(rowx)

So far I don't see "MUCH" easier ... than what? Perhaps much easier
than using odfpy, which states right up front """Odfpy aims to be a
complete API for OpenDocument in Python. Unlike other more convenient
APIs, this one is essentially an abstraction layer just above the XML
format.""" Perhaps much easier than using COM?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to