Issue
Can somebody explain this? My test excel contains only 1 sheet, but it seems to sit behind sheet_name=1 and what's that "1.1.1" which is behind sheet_name=0?
My Excel looks like this:
I'm using LibreOffice v6.4.7.2, saving as the suggested "Excel 2007-365 Format". Pandas is at v2.0.2 and Python at v3.11.3. All my search results claim that I should receive sheet 1 by using sheet_name=0. But I don't and I don't find any cases like this.
Solution
@BigBen is totally right, you should have a hidden sheet. You can use the following code to check the state of each sheet:
with pd.ExcelFile('testupload.xlsx') as xlsx:
wb = xlsx.book
for sheetname in wb.sheetnames:
sheet = wb[sheetname]
print(f'{sheetname}: {sheet.sheet_state}')
Output:
Sheet1: hidden
Sheet2: visible
Only one visible sheet:
Answered By - Corralien
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.