ToucanToco / fastexcel

A Python wrapper around calamine
http://fastexcel.toucantoco.dev/
MIT License
82 stars 4 forks source link

load_sheet_by_name raises generic CalamineError instead of SheetNotFoundError #221

Closed sean-moore3 closed 3 months ago

sean-moore3 commented 3 months ago

Hi,

While loading a sheet from a reader, if a missing sheet name is provided a generic CalamineError is raised instead of the more specific SheetNotFoundError.

My use case is:

sheets = []
for reader in readers:
    try:
        sheet = reader.load_sheet_by_name("sheet_name")
    except SheetNotFoundError:
        continue
    # Do some other stuff with sheet before appending to list.
PrettyWood commented 3 months ago

Hi @sean-moore3 Thanks for reporting this is indeed a bug. I'll push a fix