You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "carlosaran667 (via GitHub)" <gi...@apache.org> on 2026/03/10 09:15:19 UTC
[I] Export to pivoted Excel inconsistent formatting [superset]
carlosaran667 opened a new issue, #38555:
URL: https://github.com/apache/superset/issues/38555
### Bug description
I tried the new "Export to Pivoted Excel" feature for pivot tables and found an inconsistency in number formatting when using a custom D3_FORMAT.
I am using standard Spanish formatting in config.py:
D3_FORMAT: D3Format = {
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", "ā¬"]
}
### Steps to reproduce
1. Swap decimal and thousands separators in D3_FORMAT in the configuration file.
2. Restart Superset.
3. Create a "pivot table" graph.
4. Select a metric with decimal values.
5. Click on Download -> Export to Pivoted Excel
### Expected behavior
Exported decimal values should respect the decimal separator defined in D3_FORMAT.
### Actual behavior
When exporting with Export to Pivoted Excel, plain decimal numbers do not respect the decimal separator configured in D3_FORMAT.
Percentages and currency values are exported correctly (although percentage values with decimals seem to have a separate issue, which I will report independently).
In my case, since I switched from the default American-style formatting to Spanish formatting, this causes wrong values to be exported to Excel.
### Additional context
I tried modifying "EXCEL_EXPORT: dict[str, Any] = {}" in config.py, but it looks like this export path is using a front-end hard-coded configuration instead of EXCEL_EXPORT.
### Screenshots/recordings
Superset UI:

Excel:
<img width="1833" height="468" alt="Image" src="https://github.com/user-attachments/assets/5742e669-36fa-4354-b11d-89751cf5739d" />
### Superset version
6.0.0
### Python version
3.10
### Node version
I don't know
### Browser
Firefox
### Additional context
Tested on both Firefox and Microsoft Edge.
FEATURE_FLAGS: dict[str, bool] = {
"DASHBOARD_RBAC": True,
"ENABLE_TEMPLATE_PROCESSING": True,
"CACHE_QUERY_BY_USER": True,
"CACHE_IMPERSONATION": True,
}
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
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: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4031112058
<!-- Answer -->
That explains it! The **"Export to Pivoted Excel" feature runs entirely in the browser** - it doesn't go through the Python backend at all.
Based on [PR #33569](https://github.com/apache/superset/pull/33569), this feature:
1. Uses the **SheetJS (xlsx) JavaScript library** in the browser
2. Reads the **rendered HTML pivot table directly from the DOM** (the `.pvtTable` element you see on screen)
3. Converts it to Excel using `XLSX.utils.table_to_book()` client-side
4. Downloads the file directly without any API calls
**This is why modifying `superset/utils/excel.py` has no effect** - that code is never executed for pivoted Excel exports.
To customize the number formatting for pivoted Excel exports, you'd need to modify the frontend JavaScript code. The relevant file would be something like `downloadAsPivotExcel.ts` in the superset-frontend directory. You can verify this is what's happening by:
1. Opening browser DevTools (F12) ā Network tab
2. Clicking "Export to Pivoted Excel"
3. You should see **no network request** to the backend - it's all happening client-side
If you want to fix the formatting, the approach would be to find where SheetJS generates the Excel file in the frontend code and configure the number format there. Would you like me to help trace the exact frontend code location?
<!-- 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/a6a0b31e-764b-46db-8da1-a6d6053fbc9c?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/a6a0b31e-764b-46db-8da1-a6d6053fbc9c?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/a6a0b31e-764b-46db-8da1-a6d6053fbc9c?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/a6a0b31e-764b-46db-8da1-a6d6053fbc9c?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/a6a0b31e-764b
-46db-8da1-a6d6053fbc9c?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/a6a0b31e-764b-46db-8da1-a6d6053fbc9c?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/a6a0b31e-764b-46db-8da1-a6d6053fbc9c?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup>
[](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) [](https://cursor.com/link/prompt?text=That%20explains%20it%21%20The%20%2A%2A%22Export%20to%20Pivoted%20Excel%22%20feature%20runs%20entirely%20in%20the%20browser%2A%2A%20-%20it%20doesn%27t%20go%20through%20the%20Python%20backend%20at%20all.%0A%0ABased%20on%20%5BPR%20%2333569%5D%28https%3A//github.com/apache/superset/pull/33569%29%2C%20this%20feature%3A%0A1.%20Uses%20the%20%2A%2ASheetJS%20%28xlsx%29%20JavaScript%20library%2A%2A%20in%20the%20browser%0A2.%20Reads%20the%20%2A%2Arendered%20HTML%20pivot%20table%20directly%20from%20the%20DOM%2A%2A%20%28the%20%60.pvtTable%60%20element%20you%20see%20on%20screen%29%0A3.%20Converts%20it%20to%20Excel%20using%20%60XLSX.utils.table_to_book%28%29%60%20client-side%0A4.%20Downlo
ads%20the%20file%20directly%20without%20any%20API%20calls%0A%0A%2A%2AThis%20is%20why%20modifying%20%60superset/utils/excel.py%60%20has%20no%20effect%2A%2A%20-%20that%20code%20is%20never%20executed%20for%20pivoted%20Excel%20exports.%0A%0ATo%20customize%20the%20number%20formatting%20for%20pivoted%20Excel%20exports%2C%20you%27d%20need%20to%20modify%20the%20frontend%20JavaScript%20code.%20The%20relevant%20file%20would%20be%20something%20like%20%60downloadAsPivotExcel.ts%60%20in%20the%20superset-frontend%20directory.%20You%20can%20verify%20this%20is%20what%27s%20happening%20by%3A%0A1.%20Opening%20browser%20DevTools%20%28F12%29%20%E2%86%92%20Network%20tab%0A2.%20Clicking%20%22Export%20to%20Pivoted%20Excel%22%0A3.%20You%20should%20see%20%2A%2Ano%20network%20request%2A%2A%20to%20the%20backend%20-%20it%27s%20all%20happening%20client-side%0A%0AIf%20you%20want%20to%20fix%20the%20formatting%2C%20the%20approach%20would%20be%20to%20find%20where%20SheetJS%20generates%20the%20Excel%20file%20in%20th
e%20frontend%20code%20and%20configure%20the%20number%20format%20there.%20Would%20you%20like%20me%20to%20help%20trace%20the%20exact%20frontend%20code%20location%3F) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "carlosaran667 (via GitHub)" <gi...@apache.org>.
carlosaran667 commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4030974858
Yeah, as I thought, excel.py is used on "Export to Excel", but not on the "Export to pivoted Excel" button.
@dosu can you check what does the button "Export to pivoted Excel" actually executes?
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "carlosaran667 (via GitHub)" <gi...@apache.org>.
carlosaran667 commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4029974962
@dosu Since it's my first time working on Superset's backend files (other than config.py), walk me through what I should try to change in utils/excel.py.
Let's start simple by hard-coding my D3_FORMAT directly, not reading it from the config file.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4030027483
<!-- Answer -->
Here's how to modify [`superset/utils/excel.py`](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/excel.py#L43-L53) to hardcode Spanish number formatting:
**Current code (lines 43-53):**
```python
def df_to_excel(df: pd.DataFrame, **kwargs: Any) -> Any:
output = io.BytesIO()
df = quote_formulas(df)
with pd.ExcelWriter(output, engine="xlsxwriter") as writer:
df.to_excel(writer, **kwargs)
return output.getvalue()
```
**Replace with:**
```python
def df_to_excel(df: pd.DataFrame, **kwargs: Any) -> Any:
output = io.BytesIO()
df = quote_formulas(df)
with pd.ExcelWriter(output, engine="xlsxwriter") as writer:
df.to_excel(writer, **kwargs)
# Access xlsxwriter objects for custom formatting
workbook = writer.book
worksheet = writer.sheets['Sheet1']
# Spanish format: period for thousands, comma for decimal
spanish_format = workbook.add_format({
'num_format': '#.##0,00'
})
# Apply to numeric columns
numeric_cols = df.select_dtypes(include=['float64', 'int64', 'float32', 'int32']).columns
for col_idx, col_name in enumerate(df.columns):
if col_name in numeric_cols:
# +1 offset because pandas writes index as first column by default
excel_col_idx = col_idx + 1 if kwargs.get('index', True) else col_idx
from xlsxwriter.utility import xl_col_to_name
col_letter = xl_col_to_name(excel_col_idx)
worksheet.set_column(f'{col_letter}:{col_letter}', None, spanish_format)
return output.getvalue()
```
**Key points:**
- The format string `'#.##0,00'` uses period for thousands and comma for decimals (Spanish style)
- Access the workbook/worksheet **after** `df.to_excel()` writes the data
- The `+1` offset accounts for pandas writing the DataFrame index as column A by default
After modifying, restart Superset and test the export. Let me know if you hit any issues!
<!-- 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/b1f2a247-76c1-4262-829e-18fe6ab711ca?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/b1f2a247-76c1-4262-829e-18fe6ab711ca?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/b1f2a247-76c1-4262-829e-18fe6ab711ca?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/b1f2a247-76c1-4262-829e-18fe6ab711ca?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/b1f2a247-76c1
-4262-829e-18fe6ab711ca?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/b1f2a247-76c1-4262-829e-18fe6ab711ca?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/b1f2a247-76c1-4262-829e-18fe6ab711ca?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup>
[](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) [](https://cursor.com/link/prompt?text=Here%27s%20how%20to%20modify%20%5B%60superset/utils/excel.py%60%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/excel.py%23L43-L53%29%20to%20hardcode%20Spanish%20number%20formatting%3A%0A%0A%2A%2ACurrent%20code%20%28lines%2043-53%29%3A%2A%2A%0A%60%60%60python%0Adef%20df_to_excel%28df%3A%20pd.DataFrame%2C%20%2A%2Akwargs%3A%20Any%29%20-%3E%20Any%3A%0A%20%20%20%20output%20%3D%20io.BytesIO%28%29%0A%20%20%20%20df%20%3D%20quote_formulas%28df%29%0A%20%20%20%20with%20pd.ExcelWriter%28output%2C%20engine%3D%22xlsxwriter%22%29%20as%20writer%3A%0A%20%20%20%20%20%20%20%20df.to_excel%28writer%2C%20%2A%2Akwargs%29%0A%20%20%20%20return
%20output.getvalue%28%29%0A%60%60%60%0A%0A%2A%2AReplace%20with%3A%2A%2A%0A%60%60%60python%0Adef%20df_to_excel%28df%3A%20pd.DataFrame%2C%20%2A%2Akwargs%3A%20Any%29%20-%3E%20Any%3A%0A%20%20%20%20output%20%3D%20io.BytesIO%28%29%0A%20%20%20%20df%20%3D%20quote_formulas%28df%29%0A%20%20%20%20%0A%20%20%20%20with%20pd.ExcelWriter%28output%2C%20engine%3D%22xlsxwriter%22%29%20as%20writer%3A%0A%20%20%20%20%20%20%20%20df.to_excel%28writer%2C%20%2A%2Akwargs%29%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%23%20Access%20xlsxwriter%20objects%20for%20custom%20formatting%0A%20%20%20%20%20%20%20%20workbook%20%3D%20writer.book%0A%20%20%20%20%20%20%20%20worksheet%20%3D%20writer.sheets%5B%27Sheet1%27%5D%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%23%20Spanish%20format%3A%20period%20for%20thousands%2C%20comma%20for%20decimal%0A%20%20%20%20%20%20%20%20spanish_format%20%3D%20workbook.add_format%28%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%27num_format%27%3A%20%27%23.%23%230%2C00%27%0A%20%
20%20%20%20%20%20%20%7D%29%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%23%20Apply%20to%20numeric%20columns%0A%20%20%20%20%20%20%20%20numeric_cols%20%3D%20df.select_dtypes%28include%3D%5B%27float64%27%2C%20%27int64%27%2C%20%27float32%27%2C%20%27int32%27%5D%29.columns%0A%20%20%20%20%20%20%20%20for%20col_idx%2C%20col_name%20in%20enumerate%28df.columns%29%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20col_name%20in%20numeric_cols%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20%2B1%20offset%20because%20pandas%20writes%20index%20as%20first%20column%20by%20default%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20excel_col_idx%20%3D%20col_idx%20%2B%201%20if%20kwargs.get%28%27index%27%2C%20True%29%20else%20col_idx%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20from%20xlsxwriter.utility%20import%20xl_col_to_name%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20col_letter%20%3D%20xl_col_to_name%28excel_col_idx%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20works
heet.set_column%28f%27%7Bcol_letter%7D%3A%7Bcol_letter%7D%27%2C%20None%2C%20spanish_format%29%0A%20%20%20%20%0A%20%20%20%20return%20output.getvalue%28%29%0A%60%60%60%0A%0A%2A%2AKey%20points%3A%2A%2A%0A-%20The%20format%20string%20%60%27%23.%23%230%2C00%27%60%20uses%20period%20for%20thousands%20and%20comma%20for%20decimals%20%28Spanish%20style%29%0A-%20Access%20the%20workbook/worksheet%20%2A%2Aafter%2A%2A%20%60df.to_excel%28%29%60%20writes%20the%20data%0A-%20The%20%60%2B1%60%20offset%20accounts%20for%20pandas%20writing%20the%20DataFrame%20index%20as%20column%20A%20by%20default%0A%0AAfter%20modifying%2C%20restart%20Superset%20and%20test%20the%20export.%20Let%20me%20know%20if%20you%20hit%20any%20issues%21) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4030313252
<!-- Answer -->
I found an important issue - looking at the actual [`excel.py` source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/excel.py#L43-L53), the sheet name is `"Sheet 1"` (with a space), not `'Sheet1'`. My earlier suggestion was wrong.
Let's add logging to verify your changes are being executed. Update your `df_to_excel()` function in `superset/utils/excel.py`:
```python
import logging # Add at top of file if not present
logger = logging.getLogger(__name__)
def df_to_excel(df: pd.DataFrame, **kwargs: Any) -> Any:
logger.warning("=== df_to_excel called ===") # Using warning so it shows regardless of log level
logger.warning("DataFrame shape: %s, columns: %s", df.shape, list(df.columns))
output = io.BytesIO()
df = quote_formulas(df)
with pd.ExcelWriter(output, engine="xlsxwriter") as writer:
df.to_excel(writer, **kwargs)
workbook = writer.book
worksheet = writer.sheets["Sheet 1"] # Note: "Sheet 1" with space!
spanish_format = workbook.add_format({
'num_format': '#.##0,00'
})
numeric_cols = df.select_dtypes(include=['float64', 'int64', 'float32', 'int32']).columns
logger.warning("Numeric columns found: %s", list(numeric_cols))
for col_idx, col_name in enumerate(df.columns):
if col_name in numeric_cols:
excel_col_idx = col_idx + 1 if kwargs.get('index', True) else col_idx
from xlsxwriter.utility import xl_col_to_name
col_letter = xl_col_to_name(excel_col_idx)
worksheet.set_column(f'{col_letter}:{col_letter}', None, spanish_format)
logger.warning("Applied Spanish format to column %s (%s)", col_name, col_letter)
logger.warning("=== Excel generation complete ===")
return output.getvalue()
```
After restarting Superset:
1. Perform the export and check your server logs for the `=== df_to_excel called ===` messages
2. If you **don't** see these log messages, the code isn't being reached (might be caching or a different export path)
3. If you **do** see them but no formatting change, let me know what the logs say about numeric columns
Also, make sure to fully restart Superset (not just reload) after making changes.
<!-- 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/d8788476-7e04-42fa-a32a-543839aec25c?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/d8788476-7e04-42fa-a32a-543839aec25c?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/d8788476-7e04-42fa-a32a-543839aec25c?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/d8788476-7e04-42fa-a32a-543839aec25c?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/d8788476-7e04
-42fa-a32a-543839aec25c?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/d8788476-7e04-42fa-a32a-543839aec25c?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/d8788476-7e04-42fa-a32a-543839aec25c?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup>
[](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) [](https://cursor.com/link/prompt?text=I%20found%20an%20important%20issue%20-%20looking%20at%20the%20actual%20%5B%60excel.py%60%20source%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/excel.py%23L43-L53%29%2C%20the%20sheet%20name%20is%20%60%22Sheet%201%22%60%20%28with%20a%20space%29%2C%20not%20%60%27Sheet1%27%60.%20My%20earlier%20suggestion%20was%20wrong.%0A%0ALet%27s%20add%20logging%20to%20verify%20your%20changes%20are%20being%20executed.%20Update%20your%20%60df_to_excel%28%29%60%20function%20in%20%60superset/utils/excel.py%60%3A%0A%0A%60%60%60python%0Aimport%20logging%20%20%23%20Add%20at%20top%20of%20file%20if%20not%20present%0A%0Alogger%20%3D%20logging.g
etLogger%28__name__%29%0A%0Adef%20df_to_excel%28df%3A%20pd.DataFrame%2C%20%2A%2Akwargs%3A%20Any%29%20-%3E%20Any%3A%0A%20%20%20%20logger.warning%28%22%3D%3D%3D%20df_to_excel%20called%20%3D%3D%3D%22%29%20%20%23%20Using%20warning%20so%20it%20shows%20regardless%20of%20log%20level%0A%20%20%20%20logger.warning%28%22DataFrame%20shape%3A%20%25s%2C%20columns%3A%20%25s%22%2C%20df.shape%2C%20list%28df.columns%29%29%0A%20%20%20%20%0A%20%20%20%20output%20%3D%20io.BytesIO%28%29%0A%20%20%20%20df%20%3D%20quote_formulas%28df%29%0A%20%20%20%20%0A%20%20%20%20with%20pd.ExcelWriter%28output%2C%20engine%3D%22xlsxwriter%22%29%20as%20writer%3A%0A%20%20%20%20%20%20%20%20df.to_excel%28writer%2C%20%2A%2Akwargs%29%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20workbook%20%3D%20writer.book%0A%20%20%20%20%20%20%20%20worksheet%20%3D%20writer.sheets%5B%22Sheet%201%22%5D%20%20%23%20Note%3A%20%22Sheet%201%22%20with%20space%21%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20spanish_format%20%3D%20workbook.
add_format%28%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%27num_format%27%3A%20%27%23.%23%230%2C00%27%0A%20%20%20%20%20%20%20%20%7D%29%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20numeric_cols%20%3D%20df.select_dtypes%28include%3D%5B%27float64%27%2C%20%27int64%27%2C%20%27float32%27%2C%20%27int32%27%5D%29.columns%0A%20%20%20%20%20%20%20%20logger.warning%28%22Numeric%20columns%20found%3A%20%25s%22%2C%20list%28numeric_cols%29%29%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for%20col_idx%2C%20col_name%20in%20enumerate%28df.columns%29%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20col_name%20in%20numeric_cols%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20excel_col_idx%20%3D%20col_idx%20%2B%201%20if%20kwargs.get%28%27index%27%2C%20True%29%20else%20col_idx%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20from%20xlsxwriter.utility%20import%20xl_col_to_name%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20col_letter%20%3D%20xl_col_to_name%28excel_col_idx%29%0A%20%20%20%
20%20%20%20%20%20%20%20%20%20%20%20%20worksheet.set_column%28f%27%7Bcol_letter%7D%3A%7Bcol_letter%7D%27%2C%20None%2C%20spanish_format%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20logger.warning%28%22Applied%20Spanish%20format%20to%20column%20%25s%20%28%25s%29%22%2C%20col_name%2C%20col_letter%29%0A%20%20%20%20%0A%20%20%20%20logger.warning%28%22%3D%3D%3D%20Excel%20generation%20complete%20%3D%3D%3D%22%29%0A%20%20%20%20return%20output.getvalue%28%29%0A%60%60%60%0A%0AAfter%20restarting%20Superset%3A%0A1.%20Perform%20the%20export%20and%20check%20your%20server%20logs%20for%20the%20%60%3D%3D%3D%20df_to_excel%20called%20%3D%3D%3D%60%20messages%0A2.%20If%20you%20%2A%2Adon%27t%2A%2A%20see%20these%20log%20messages%2C%20the%20code%20isn%27t%20being%20reached%20%28might%20be%20caching%20or%20a%20different%20export%20path%29%0A3.%20If%20you%20%2A%2Ado%2A%2A%20see%20them%20but%20no%20formatting%20change%2C%20let%20me%20know%20what%20the%20logs%20say%20about%20numeric%20columns%0A%0AAlso%2C%
20make%20sure%20to%20fully%20restart%20Superset%20%28not%20just%20reload%29%20after%20making%20changes.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
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>
[](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) [](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.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4069247603
We'll hope that someone picks this up as a volunteer effort, but you're quite welcome to check out the repo locally so you DO have the frontend available to modify. We're very much open to a PR that fixes things (without hardcoding Spanish number formats, but rather being a more generalized solution).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "carlosaran667 (via GitHub)" <gi...@apache.org>.
carlosaran667 commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4031161245
Since I cannot modify the frontend in my installation, I don't think I can go much further on my side.
If anyone wants to take it from here, I would be happy to provide any additional context that may help.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #38555: Export to pivoted Excel inconsistent formatting
URL: https://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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "carlosaran667 (via GitHub)" <gi...@apache.org>.
carlosaran667 commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4030258095
@dosu nothing changed. It didn't throw any error either.
Maybe we can add some log messages to check what's actually going on or try something else.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "fowlerp397-tech (via GitHub)" <gi...@apache.org>.
fowlerp397-tech commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4073753059
Trying to reproduce this on my side
On Mon, Mar 16, 2026, 12:10 PM Evan Rusackas ***@***.***>
wrote:
> *rusackas* left a comment (apache/superset#38555)
> <https://github.com/apache/superset/issues/38555#issuecomment-4069247603>
>
> We'll hope that someone picks this up as a volunteer effort, but you're
> quite welcome to check out the repo locally so you DO have the frontend
> available to modify. We're very much open to a PR that fixes things
> (without hardcoding Spanish number formats, but rather being a more
> generalized solution).
>
> ā
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/superset/issues/38555#issuecomment-4069247603>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/B72HASISFNRDJM3FNIGSEWT4RAYR5AVCNFSM6AAAAACWM2CLDWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DANRZGI2DONRQGM>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Export to pivoted Excel inconsistent formatting [superset]
Posted by "imad-hl (via GitHub)" <gi...@apache.org>.
imad-hl commented on issue #38555:
URL: https://github.com/apache/superset/issues/38555#issuecomment-4351650295
I ran into the same issue when using a custom D3_FORMAT. (Superset v6.0.0)
Here is my configuration:
```
D3_FORMAT = {
"decimal": ",",
"thousands": " ",
"grouping": [3],
"currency": ["ā¬", ""],
}
```
some numeric cells were converted into dates in Excel, while others lost their decimal separator and were exported as plain integers
<img width="733" height="849" alt="Image" src="https://github.com/user-attachments/assets/4ab152ec-d7f4-43cc-b013-bf3cca4c9521" />
For now, the only stable workaround I found is to **revert to the default D3_FORMAT** config, since it restores consistent numeric exports
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org