Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix FutureWarning: Add test to verify bytes are wrapped in BytesIO for read_excel#4213

Open
Good0987 wants to merge 2 commits intoUnstructured-IO:mainfrom
Good0987:fix/future-warning-read-excel-bytes
Open

Fix FutureWarning: Add test to verify bytes are wrapped in BytesIO for read_excel#4213
Good0987 wants to merge 2 commits intoUnstructured-IO:mainfrom
Good0987:fix/future-warning-read-excel-bytes

Conversation

@Good0987
Copy link

@Good0987 Good0987 commented Jan 27, 2026

This PR addresses issue #4036 by ensuring bytes are properly wrapped in BytesIO before passing to pd.read_excel().

Implementation:
The code at line 203 in unstructured/partition/xlsx.py already wraps bytes in BytesIO before calling pd.read_excel(), which is the correct solution to avoid the FutureWarning deprecation.

Changes made:

  1. Added a comment (lines 200-201) explaining why bytes are wrapped in BytesIO
  2. Added a test (test_partition_xlsx_no_future_warning_for_bytes) to verify no FutureWarning is raised

This ensures the fix is documented and tested, preventing future regressions.

This test ensures that partition_xlsx properly wraps bytes in BytesIO
before passing to pd.read_excel(), preventing the deprecation warning
mentioned in issue Unstructured-IO#4036.
@Good0987
Copy link
Author

Hi @badGarnet I'd love to get your review and approval
Thank you for your time

Addresses reviewer feedback by adding a comment explaining why bytes
are wrapped in BytesIO before passing to pd.read_excel to avoid
FutureWarning deprecation. References issue Unstructured-IO#4036.
@Good0987
Copy link
Author

Hi, @badGarnet #4036
this issue is to wrap funcion in BytesIO. but that function already wapped by BytesIO.
So I added test case.
Please check my PR. I'd like to solve this issue and merge this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants