The issue is that the HTML is stored as the actual string value. AI/BI dashboards render it when the column is configured as HTML, but exports use the underlying dataset value, so the tags are included. Databricks doesn’t currently provide an export option to render HTML visually while stripping it from CSV/Excel.
A workaround could be to return two columns:
SELECT
net_sales,
outlet,
pct_sales, -- clean numeric export value
CONCAT(
'<div style="background:#e5f7ef;height:8px;width:100px;">',
'<div style="background:#00a972;height:8px;width:',
CAST(ROUND(pct_sales * 100, 2) AS STRING),
'px;"></div></div>'
) AS pct_bar_html
FROM sales_data;
Configure pct_bar_html as Display type → HTML, and use pct_sales for downloads. Hide the raw column from the visual table if needed, or provide a separate export table/widget containing only clean fields.
If you already have the HTML column, a temporary cleanup is:
regexp_replace(formatted_value, '<[^>]*>', '') AS clean_value