Skip to content

read_excel: sheet_name of non-existent sheet does not raise appropriate error for engine='odf' #27676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JasperVanDenBosch opened this issue Jul 31, 2019 · 2 comments · Fixed by #27677
Labels
IO Excel read_excel, to_excel Needs Info Clarification about behavior needed to assess issue
Milestone

Comments

@JasperVanDenBosch
Copy link
Contributor

JasperVanDenBosch commented Jul 31, 2019

Code Sample, a copy-pastable example if possible

pandas.read_excel('mybook.ods', sheet_name='mysheet', engine='odf')

Problem description

If the sheet specified does not exist, an error is thrown:

---> 63         raise ValueError("sheet {name} not found".format(name))
     64 
     65     def get_sheet_data(self, sheet, convert_float: bool) -> List[List[Scalar]]:

KeyError: 'name'


The problem is at https://github.com/pandas-dev/pandas/blob/master/pandas/io/excel/_odfreader.py#L63

Expected Output

It should raise a ValueError with text:

"sheet mysheet not found"

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.7.3.final.0
python-bits : 64
OS : Linux
OS-release : 5.0.0-20-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 0.25.0
numpy : 1.16.4
pytz : 2019.1
dateutil : 2.8.0
pip : 19.1.1
setuptools : 41.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.6.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.1
numexpr : 2.6.9
odfpy : None
openpyxl : 2.6.2
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.0https://github.com/pandas-dev/pandas/blob/master/pandas/io/excel/_odfreader.py#L63
sqlalchemy : None
tables : 3.5.2
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None

@WillAyd
Copy link
Member

WillAyd commented Jul 31, 2019

Can you attach the document?

@WillAyd WillAyd added the Needs Info Clarification about behavior needed to assess issue label Jul 31, 2019
@JasperVanDenBosch
Copy link
Contributor Author

Here is an empty workbook.ods (in a zipfile cause github doesn't allow ods attachments)

mybook.zip

JasperVanDenBosch added a commit to JasperVanDenBosch/pandas that referenced this issue Aug 1, 2019
@jbrockmendel jbrockmendel added the IO Excel read_excel, to_excel label Aug 3, 2019
@TomAugspurger TomAugspurger modified the milestones: 0.25.1, 1.0 Aug 20, 2019
@jreback jreback modified the milestones: 1.0, 0.25.2 Sep 8, 2019
JasperVanDenBosch added a commit to JasperVanDenBosch/pandas that referenced this issue Sep 10, 2019
@TomAugspurger TomAugspurger modified the milestones: 0.25.2, 1.0 Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Excel read_excel, to_excel Needs Info Clarification about behavior needed to assess issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants