Skip to content

fix(platform): normalize xlsx column headers for reliable import#1086

Merged
yannickmonney merged 1 commit into
mainfrom
fix/xlsx-import-field-matching
Apr 7, 2026
Merged

fix(platform): normalize xlsx column headers for reliable import#1086
yannickmonney merged 1 commit into
mainfrom
fix/xlsx-import-field-matching

Conversation

@yannickmonney
Copy link
Copy Markdown
Contributor

@yannickmonney yannickmonney commented Apr 7, 2026

Summary

  • Normalize all Excel record keys to lowercase+trimmed in parseExcelFile — single point of normalization
  • Simplify all three excel mappers (customer, vendor, product) to only check lowercase keys
  • Added 23 tests covering excel mapper happy paths, missing fields, and defaults

Fixes #1040, fixes #1054

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced Excel file parsing with automatic column header normalization for improved compatibility.
  • Bug Fixes

    • Fixed field mapping inconsistencies in product, customer, and vendor imports.
    • Improved validation of required fields during file uploads.
  • Tests

    • Added comprehensive test coverage for Excel import scenarios.

…ield matching

parseExcelFile now trims and lowercases all record keys from sheet_to_json,
so excel mappers no longer need multiple case variants for each field lookup.
Fixes product import "No valid product data found" and customer import
loading incorrect data when column headers differ in casing.

Closes #1040, closes #1054
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@yannickmonney yannickmonney merged commit c7a11b5 into main Apr 7, 2026
20 of 24 checks passed
@yannickmonney yannickmonney deleted the fix/xlsx-import-field-matching branch April 7, 2026 21:55
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This pull request normalizes Excel column header handling during file imports. The file parsing utility now trims whitespace and converts all column headers to lowercase when reading Excel files. The import mappers for vendors, customers, and products are updated to work with these normalized keys, removing fallbacks for alternate key casings. A comprehensive test suite validates that the Excel parsers correctly handle lowercase keys, apply appropriate defaults, enforce required fields, and normalize specific field names like imageurl to imageUrl.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: normalizing XLSX column headers for reliable import.
Linked Issues check ✅ Passed The PR addresses both linked issues by implementing case-insensitive field matching and normalizing column headers to resolve product and customer import failures.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing XLSX import issues; test additions, mapper simplifications, and header normalization align with addressing the linked issues.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/xlsx-import-field-matching

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

1 participant