(Jun-02-2017, 11:14 AM)BNB Wrote:#!/usr/bin/python import os from openpyxl.reader.excel import load_workbook import csv
I am not sure why are you using
openpyxl.reader.excel
, I just checked a code I've written several week ago from openpyxl import Workbook, load_workbookWorks just fine.
wb.get_sheet_by_name
causes exception if the sheet with that name does not exist - but I guess that is not your problem.PS I am not sure why, but it is recommended to open
csv
files with newline=''
argumentAnother thing - you are collecting the same data for each Excel file you find. It is sort of inefficient. What exactly are you trying to do?
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.