September 23rd, 2013, 07:23 AM
Join Date: Feb 2010
Time spent in forums: 7 h 21 m 14 sec
Reputation Power: 0
Trouble getting started with Python and Excel
It has been years since I last worked with Python, and even then it was on an extremely basic level.
Now I have been asked to develop a test harness in Python for a Java application.
So... I want to sort out reading in data from spreadsheets that will then be sent off to the Java application. I have downloaded and installed the xlrd, xlwt, xlutils modules. I am just going through some simple tutorials at the moment and I am unsure as to why the following does not work:
from xlrd import *
from xlwt import *
from xlutils import *
from xlrd import open_workbook
book = open_workbook('simple.xls')
for sheet_index in range(book.nsheets):
for sheet_name in book.sheet_names():
for sheet in book.sheets():
I am getting the following error:
AttributeError: 'module' object has no attribute 'nsheets'
Can anyone tell me why this is happening? I mean, I was under the impression that everything needed for working with excel is included in the modules I downloaded.
If anyone can shed some light that would be great - I have next to no idea what I am doing.....