Repository navigation
render as html #40900
Replies: 2 comments
|
This is expected behavior — "Render as HTML" only controls how values are displayed in the browser. When you export to CSV/Excel, Superset pulls the raw query results directly, so your Recommended fix: Use Conditional Formatting instead If your goal is just coloring values, use Superset's built-in Conditional Formatting (under the "Customize" tab in the Table chart). This applies colors natively without injecting HTML into the metric, so exports will contain only clean values. Other workarounds:
import re
# Add after verbose_map processing, before CSV/Excel conversion:
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
)The conditional formatting approach is the cleanest solution since it separates styling from data entirely. To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
|
This happens because "Render as HTML" in the Table chart is strictly a client-side frontend display feature. Why the HTML tags appear in exportsWhen you click Download CSV or Download Excel, Superset does not scrape the rendered browser DOM. Instead, it sends an API request directly to How to achieve styled display in the browser and clean exportsSolution 1: Use Native Conditional Formatting instead of HTML in SQL (Best Solution)Instead of embedding Then, use Superset's native formatting controls:
Result: The browser displays rich color highlights and badges, while CSV and Excel exports download 100% clean numbers without HTML markup. Solution 2: Expose Separate Display and Export ColumnsIf you require complex HTML that conditional formatting cannot replicate:
|
Uh oh!
There was an error while loading. Please reload this page.
so i have used render as html , and i have put span in custom sql metric in table chart m but when i am downloading as excel or csv , the value and the span code is getting downloaded not just the value
@dosu
All reactions