Skip to content

fix(converters): preserve literal NA strings in XLSXToDocument (#12945) - #13044

Open
HarshitR2004 wants to merge 2 commits into
deepset-ai:mainfrom
HarshitR2004:fix-xlsx-drops-literal-na-values
Open

HarshitR2004 wants to merge 2 commits into
deepset-ai:mainfrom
HarshitR2004:fix-xlsx-drops-literal-na-values

Conversation

@HarshitR2004

Copy link
Copy Markdown

Related Issues

Proposed Changes:

  • Default keep_default_na=False and na_values=[""] in XLSXToDocument._extract_tables().
  • Prevents pandas.read_excel from coercing literal string cells like "NA", "N/A", "NaN", or "null" into missing values and converting them to empty cells.
  • Preserves genuinely empty cells as empty while maintaining caller overrides via read_excel_kwargs.
  • Updated read_excel_kwargs docstring to reflect the default behavior.

How did you test it?

  • Added test_run_preserves_literal_na_strings: verifies literal "NA" and "N/A" are preserved in CSV and Markdown tables while empty cells remain blank.
  • Added test_run_keep_default_na_override: verifies passing read_excel_kwargs={"keep_default_na": True} allows opting back into pandas' default NA parsing.
  • Ran tests: hatch -e test run pytest test/components/converters/test_xlsx_to_document.py (32 passed).
  • Ran type checks (mypy) and linting (ruff).

Notes for the reviewer

  • Defaulting na_values=[""] alongside keep_default_na=False ensures unpopulated cells from openpyxl are still identified as missing values by pandas, so Markdown missingval and CSV formatting remain consistent.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@HarshitR2004
HarshitR2004 requested a review from a team as a code owner September 30, 2026 17:50
@HarshitR2004
HarshitR2004 requested review from bogdankostic and removed request for a team September 30, 2026 17:50
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@HarshitR2004 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Sep 30, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @HarshitR2004, thanks for your interest in contributing to Haystack! 🙏

⚠️ Issue #12945 is already being addressed by open pull request(s) #12951. Before opening a PR for an issue, please check whether a PR is already linked to it, and consider contributing to the existing PR instead. We may close duplicate PRs to keep the review queue manageable.

This is an automated message to help us keep the review queue healthy.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XLSXToDocument drops literal NA and N/A cell values

2 participants