Mar-13-2019, 09:46 AM
Hello,
I would like to modify my existing code that extracts the value of some cells. How can I modify it to do it not only one but for more xls, that are in the same directory.
I tried something like this:
I would like to modify my existing code that extracts the value of some cells. How can I modify it to do it not only one but for more xls, that are in the same directory.
I tried something like this:
import xlrd import glob for filename in glob.glob('*.xls'): book = xlrd.open_workbook("*.xls", formatting_info=True) sheets = book.sheet_names() for index, sh in enumerate(sheets): sheet = book.sheet_by_index(index) #print "Sheet:", sheet.name rows, cols = sheet.nrows, sheet.ncols #print "Number of rows: %s Number of cols: %s" % (rows, cols) for row in range(rows): for col in range(cols): ....the error is
Quote:IOError: [Errno 22] invalid mode ('rb') or filename: '*.xls'