feat(confluence): support xlsx attachments#502
Open
lvlcn-t wants to merge 4 commits intolangchain-ai:mainfrom
Open
feat(confluence): support xlsx attachments#502lvlcn-t wants to merge 4 commits intolangchain-ai:mainfrom
lvlcn-t wants to merge 4 commits intolangchain-ai:mainfrom
Conversation
Relates to langchain-ai#413 Signed-off-by: lvlcn-t <75443136+lvlcn-t@users.noreply.github.com>
…ownload failures Signed-off-by: lvlcn-t <75443136+lvlcn-t@users.noreply.github.com>
Signed-off-by: lvlcn-t <75443136+lvlcn-t@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for .xlsx (modern Excel) attachments in the ConfluenceLoader by implementing a new process_xlsx() method that uses the openpyxl library. Currently, only .xls (legacy Excel) files are supported.
Changes:
- Added
process_xlsx()method to handle.xlsxfiles usingopenpyxl - Updated
process_attachment()to dispatch on the.xlsxmedia type - Added comprehensive unit tests for both successful and failed download scenarios
- Cleaned up imports in test file (removed unused
unittestimport)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
libs/community/langchain_community/document_loaders/confluence.py |
Added process_xlsx() method and dispatching logic for .xlsx media type |
libs/community/tests/unit_tests/document_loaders/test_confluence.py |
Added unit tests for xlsx attachment processing and cleaned up imports |
Comments suppressed due to low confidence (2)
libs/community/langchain_community/document_loaders/confluence.py:47
- The class docstring should be updated to explicitly mention that both .xls and .xlsx Excel formats are now supported. Consider changing "Excel" to "Excel (.xls and .xlsx)" to clarify that both legacy and modern Excel formats are supported.
Document object. Currently supported attachment types are: PDF, PNG, JPEG/JPG,
SVG, Word and Excel.
libs/community/tests/unit_tests/document_loaders/test_confluence.py:389
- The helper method
_create_xlsx_bytes()lacks a docstring explaining its purpose. Following the coding guidelines, this should include a brief description of what it does and what it returns, especially since it's a test utility that could be reused.
def _create_xlsx_bytes(self) -> bytes:
libs/community/langchain_community/document_loaders/confluence.py
Outdated
Show resolved
Hide resolved
libs/community/langchain_community/document_loaders/confluence.py
Outdated
Show resolved
Hide resolved
libs/community/langchain_community/document_loaders/confluence.py
Outdated
Show resolved
Hide resolved
Signed-off-by: lvlcn-t <75443136+lvlcn-t@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds support for Confluence
.xlsxattachments inConfluenceLoaderby dispatching on the.xlsxmedia type and extracting sheet/row text usingopenpyxl. Includes a minimal unit test covering the happy path and a failed-download path.Fixes #413
Dependencies
openpyxlis an optional dependency used only when processing.xlsxattachments.@pytest.mark.requires("openpyxl").Tests done
make formatlocallymake lintmake testsReview focus
ConfluenceLoader.process_attachment()for the.xlsxmedia type.process_xlsx()output formatting (sheet header + tab-separated rows).