Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.
This repository was archived by the owner on Jun 19, 2026. It is now read-only.

Add support for .xlsx files in confluence loader #413

Description

@rahulcseng

Checked other resources

  • This is a feature request, not a bug report or usage question.
  • I added a clear and descriptive title that summarizes the feature request.
  • I used the GitHub search to find a similar feature request and didn't find it.
  • I checked the LangChain documentation and API reference to see if this feature already exists.

Feature Description

I would like this community to support .xlsx files in confluence loader. Currently only .xls files are supported as attachment.

Use Case

I have .xlsx file as attachment in confluence but it is not getting loaded in final documents returned by the loader.

Proposed Solution

This could be implemented by:

Adding below code in confluence.py process_attachment method:

elif media_type == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
# FIX: Add support for modern .xlsx files
logger.info(f"Processing .xlsx attachment: {title}")
text = title + self.process_xlsx(absolute_url)

Adding below method:

def process_xlsx(self, link: str) -> str:
"""Process .xlsx files using openpyxl."""
try:
import openpyxl
except ImportError:
raise ImportError(
"openpyxl package not found, please run pip install openpyxl"
)

    response = self.confluence.request(path=link, absolute=True)
    
    if response.status_code != 200 or not response.content:
        logger.warning(f"Failed to download .xlsx from {link}")
        return ""

    try:
        excel_file = io.BytesIO(response.content)
        workbook = openpyxl.load_workbook(excel_file, data_only=True)
        
        text = ""
        for sheet_name in workbook.sheetnames:
            sheet = workbook[sheet_name]
            text += f"\n{sheet_name}:\n"
            
            for row in sheet.iter_rows(values_only=True):
                row_text = "\t".join(
                    str(cell) if cell is not None else "" 
                    for cell in row
                )
                text += f"{row_text}\n"
            text += "\n"
            
        return text
        
    except Exception as e:
        logger.error(f"Error processing .xlsx: {e}")
        return ""

Alternatives Considered

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions