Skip to content

fix: preserve currency formatting in XLSX conversion (#53)#2149

Open
BB0813 wants to merge 1 commit into
microsoft:mainfrom
BB0813:fix/xlsx-currency-format
Open

fix: preserve currency formatting in XLSX conversion (#53)#2149
BB0813 wants to merge 1 commit into
microsoft:mainfrom
BB0813:fix/xlsx-currency-format

Conversation

@BB0813

@BB0813 BB0813 commented Jun 21, 2026

Copy link
Copy Markdown

When Excel cells use currency number formats (e.g. $#,##0.00 or €#,##0.00), pandas only reads the raw numeric value and discards the currency symbol. This caused output like '5' instead of '$5'.

After reading the DataFrame with pandas, we now use openpyxl to inspect each cell's number_format. Numeric cells with currency formats get their values replaced with formatted strings so the currency symbol is preserved in the Markdown output.

Supports:

  • Standard formats: $#,##0.00, €#,##0.00, £#,##0.00, etc.
  • Accounting formats: ($* #,##0.00)
  • Decimal precision matching the format string (e.g. $5.00, €199)
  • Negative values: -$50.50
  • 14 common currency symbols

Fixes #53

When Excel cells use currency number formats (e.g. $#,##0.00 or
€#,##0.00), pandas only reads the raw numeric value and discards the
currency symbol. This caused output like '5' instead of '$5'.

After reading the DataFrame with pandas, we now use openpyxl to inspect
each cell's number_format. Numeric cells with currency formats get their
values replaced with formatted strings so the currency symbol is
preserved in the Markdown output.

Supports:
- Standard formats: $#,##0.00, €#,##0.00, £#,##0.00, etc.
- Accounting formats: _($* #,##0.00_)
- Decimal precision matching the format string (e.g. $5.00, €199)
- Negative values: -$50.50
- 14 common currency symbols

Fixes microsoft#53
@BB0813

BB0813 commented Jun 21, 2026

Copy link
Copy Markdown
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