July 18th, 2012, 11:20 AM
Join Date: Jul 2012
Time spent in forums: 58 m 47 sec
Reputation Power: 0
Reading single cells in excel using Python
I am trying to read single cells in excel using python. I am not interested in reading the entire sheet at once just one cell at a time.
Basically I want to be able to read say Cell A1, store it in a variable and B1 store it in a variable.
If both cells can be read at once and stored in variables that would be better.
Here is what my code looks like:
wb = xlrd.open_workbook("Table.xls")
sh1 = wb.sheet_by_index(0)
print "content of", sh1.name
for rownum in range(sh1.nrows):
this returns the entire sheet like this:
all I want to be able to do is save the first part of line 1 into a separate variable and do the same for the second part.
The rest of the rows in the spread sheet will be read using a loop.
Please note this is just a part of an entire syntax which takes the information from here and applies in other processes.
I hope I've given enough info. Any help is appreciated.