dosubot[bot] commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4029868398

   <!-- Greeting -->
   Hi @carlosaran667! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping 
the superset team.
   
   <!-- Answer -->
   This is a **known architectural limitation** in Superset. [D3_FORMAT only 
affects frontend UI rendering and does not apply to CSV/Excel 
exports](https://github.com/apache/superset/discussions/34568).
   
   **Why percentages/currency work but plain numbers don't:** Percentages and 
currency appear to be pre-formatted in the frontend before being sent to the 
export pipeline, while plain decimal numbers are sent as raw values and rely on 
the [Excel export 
logic](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/excel.py#L43-L53),
 which uses pandas' `to_excel()` method without custom number formatting.
   
   **Why `EXCEL_EXPORT` doesn't help:** This config only passes arguments to 
pandas' `to_excel()` method, which doesn't have parameters for locale-specific 
number formatting like D3_FORMAT provides.
   
   **Related developments:**
   - [PR #38170](https://github.com/apache/superset/pull/38170) fixes CSV 
decimal separator issues but **does not address Excel exports**
   - [Issue #35524](https://github.com/apache/superset/issues/35524) tracks a 
related D3_FORMAT regression in 6.0.0-RC2
   
   **Workarounds (limited):**
   1. Post-process exported files using external tools (openpyxl, Excel macros)
   2. Use CSV export instead (once PR #38170 is merged) and import into Excel 
with correct locale settings
   3. Code modification: Patch 
[`superset/utils/excel.py`](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/excel.py#L43-L53)
 to access xlsxwriter's formatting API and apply custom number formats based on 
D3_FORMAT
   
   This would require mapping D3 format patterns to Excel number format codes 
and applying them via `workbook.add_format()` - a non-trivial change that isn't 
currently on the roadmap.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention 
[@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/f7cc4a6d-eb44-4ea2-98a4-a96ddcf25007?feedback_type=great_response&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/f7cc4a6d-eb44-4ea2-98a4-a96ddcf25007?feedback_type=irrelevant_answer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/f7cc4a6d-eb44-4ea2-98a4-a96ddcf25007?feedback_type=incorrect_sources&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/f7cc4a6d-eb44-4ea2-98a4-a96ddcf25007?feedback_type=too_verbose&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose)
 | [Hallucination](https://app.dosu.dev/response-feedback/f7cc4a6d-eb44
 
-4ea2-98a4-a96ddcf25007?feedback_type=hallucination&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination)
 | [Report 
šŸ›](https://app.dosu.dev/response-feedback/f7cc4a6d-eb44-4ea2-98a4-a96ddcf25007?feedback_type=bug_report&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/f7cc4a6d-eb44-4ea2-98a4-a96ddcf25007?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20%2A%2Aknown%20architectural%20limitation%2A%2A%20in%20Superset.%20%5BD3_FORMAT%20only%20affects%20frontend%20UI%20rendering%20and%20does%20not%20apply%20to%20CSV/Excel%20exports%5D%28https%3A//github.com/apache/superset/discussions/34568%29.%0A%0A%2A%2AWhy%20percentages/currency%20work%20but%20plain%20numbers%20don%27t%3A%2A%2A%20Percentages%20and%20currency%20appear%20to%20be%20pre-formatted%20in%20the%20frontend%20before%20being%20sent%20to%20the%20export%20pipeline%2C%20while%20plain%20decimal%20numbers%20are%20sent%20as%20raw%20values%20and%20rely%20on%20the%20%5BExcel%20export%20logic%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1e
 
d3b063ffe45377799c/superset/utils/excel.py%23L43-L53%29%2C%20which%20uses%20pandas%27%20%60to_excel%28%29%60%20method%20without%20custom%20number%20formatting.%0A%0A%2A%2AWhy%20%60EXCEL_EXPORT%60%20doesn%27t%20help%3A%2A%2A%20This%20config%20only%20passes%20arguments%20to%20pandas%27%20%60to_excel%28%29%60%20method%2C%20which%20doesn%27t%20have%20parameters%20for%20locale-specific%20number%20formatting%20like%20D3_FORMAT%20provides.%0A%0A%2A%2ARelated%20developments%3A%2A%2A%0A-%20%5BPR%20%2338170%5D%28https%3A//github.com/apache/superset/pull/38170%29%20fixes%20CSV%20decimal%20separator%20issues%20but%20%2A%2Adoes%20not%20address%20Excel%20exports%2A%2A%0A-%20%5BIssue%20%2335524%5D%28https%3A//github.com/apache/superset/issues/35524%29%20tracks%20a%20related%20D3_FORMAT%20regression%20in%206.0.0-RC2%0A%0A%2A%2AWorkarounds%20%28limited%29%3A%2A%2A%0A1.%20Post-process%20exported%20files%20using%20external%20tools%20%28openpyxl%2C%20Excel%20macros%29%0A2.%20Use%20CSV%20export%20instea
 
d%20%28once%20PR%20%2338170%20is%20merged%29%20and%20import%20into%20Excel%20with%20correct%20locale%20settings%0A3.%20Code%20modification%3A%20Patch%20%5B%60superset/utils/excel.py%60%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/excel.py%23L43-L53%29%20to%20access%20xlsxwriter%27s%20formatting%20API%20and%20apply%20custom%20number%20formats%20based%20on%20D3_FORMAT%0A%0AThis%20would%20require%20mapping%20D3%20format%20patterns%20to%20Excel%20number%20format%20codes%20and%20applying%20them%20via%20%60workbook.add_format%28%29%60%20-%20a%20non-trivial%20change%20that%20isn%27t%20currently%20on%20the%20roadmap.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord)&nbsp;[![Share
 on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent
 
/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/38555)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to