Skip to content

fix: preserve currency number format when converting xlsx to markdown#1630

Open
zhaorong566 wants to merge 2 commits intomicrosoft:mainfrom
zhaorong566:fix/excel-currency-format
Open

fix: preserve currency number format when converting xlsx to markdown#1630
zhaorong566 wants to merge 2 commits intomicrosoft:mainfrom
zhaorong566:fix/excel-currency-format

Conversation

@zhaorong566
Copy link

What does this PR do?

Fixes the issue where currency-formatted cells in Excel files
lose their formatting (e.g., $1,199.00 becomes 1199.0)
when converted to Markdown.

How?

  • Added openpyxl-based cell format detection in _xlsx_converter.py
  • Cells with currency number_format are now rendered with
    the appropriate symbol and decimal places
  • Convert DataFrame column to object type before assigning formatted string
  • Supports USD ($), EUR (€), JPY (¥), GBP (£)

Test

Before fix:

Product Price
Apple 1199.0
Banana 299.5

After fix:

Product Price
Apple $1,199.00
Banana $299.50

Fixes

Closes #53

zhaorong566 added 2 commits March 21, 2026 16:24
- Load workbook with openpyxl to detect number_format on each cell
- Convert DataFrame column to object type before assigning formatted string
- Supports USD, EUR, JPY, GBP currency symbols

Fixes microsoft#53
@zhaorong566
Copy link
Author

@microsoft-github-policy-service agree

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.

Unable to extract currency from excel formatted cells

1 participant