LBNL-ETA / Adapter

The Adapter software is developed at the Energy Efficiency Standards Department and it provides a convenient data table loader from various formats such as xlsx, csv, db (sqlite database), and sqlalchemy. Its main feature is the ability to convert data tables identified in one main and optionally one or more additional input files into database tables and Pandas DataFrames for downstream usage in any compatible software.
1 stars 1 forks source link

update_excel #31

Closed lyralan closed 4 months ago

lyralan commented 1 year ago

With the latest Openpyxl (v3.1.0, released on 2023.01.31) leading to errors

AttributeError: 'DefinedNameDict' object has no attribute 'definedName'

when loading an Excel with named ranges in line 77 in adapter, an update in Adapter to be compatible with newer Openpyxl may be needed. An easy solution is to change line 77 to

all_input_ranges = {object_range for object_range in self.wb.defined_names}

However, this is only for folks who use v3.1.0, and this change will lead to backwards incompatibility for users with older Openpyxl versions.

Also, it may be good to check if there's any named ranges or tables in the input file if users specify kind='ranges' or kind='tables'.

lyralan commented 4 months ago

Closing this issue as issue 44 further elaborates the latest situation