GitHub user dosubot[bot] added a comment to the discussion: render as html format
<!-- Answer --> The best single file to modify is **`superset/common/query_context_processor.py`** — specifically the `get_data()` method [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/common/query_context_processor.py#L734-L754). This is the central point where all chart data (Table, Pivot Table, etc.) passes through before being converted to CSV or Excel. Modifying it here covers both export formats for all chart types. **Where to add the logic:** In the `get_data()` method, add HTML stripping **after** the verbose column mapping and **before** the format conversion (CSV/XLSX). Around line 744, before the CSV/Excel conversion begins: ```python # After verbose_map processing, add HTML stripping: for col in df.columns: if df[col].dtype == "object": df[col] = df[col].apply( lambda x: re.sub(r'<[^>]+>', '', x) if isinstance(x, str) else x ) ``` You'll need to `import re` at the top of the file. **Supporting files for reference:** - `superset/utils/csv.py` — CSV export utility [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/csv.py) - `superset/utils/excel.py` — Excel export utility [[3]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/excel.py) **Tip:** You may want to make this conditional (e.g., behind a feature flag or config option like `STRIP_HTML_ON_EXPORT = True` in `config.py`) so it doesn't unexpectedly alter exports for users who intentionally want HTML in their exported data. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).* --- Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-tagline&utm_term=apache%2Fsuperset). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-feedback&utm_term=apache%2Fsuperset&message_id=b218e750-e69d-4e8a-9bdd-7495edef1d13) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-share-team&utm_term=apache%2Fsuperset) GitHub link: https://github.com/apache/superset/discussions/40044#discussioncomment-16887674 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
