GitHub user andreebesemer created a discussion: Include applied filter settings 
in Excel and CSV exports (with configuration controls)

### Problem Description

Currently, when exporting table charts or dashboard data to Excel (`.xlsx`) or 
CSV, Superset only exports the raw filtered data rows. The active filter 
parameters (native filters, filter bar settings, time ranges, etc.) that 
generated the specific dataset are lost upon export.

This makes it difficult for recipients of the exported files to understand or 
verify the context of the data (e.g., which time range, region, or status was 
selected when the export was triggered).

### Proposed Solution / Desired Feature

Enhance the export functionality to include applied filter criteria alongside 
the exported data:

1. **Excel Export (`.xlsx`):**
* **Sheet 1:** Exported dataset (as currently done).
* **Sheet 2 (e.g., `Filter Settings` or `Metadata`):** A dedicated worksheet 
listing all active filters applied at the moment of export (e.g., Filter Name, 
Selected Values, Time Range, Export Timestamp).


2. **CSV Export (`.csv`):**
* **Option A (Recommended):** Bundle the export into a ZIP file containing two 
CSV files: `data.csv` and `filters.csv`.
* **Option B:** Add commented metadata header lines at the top of the CSV file 
detailing the active filters (e.g., `# Applied Filters: ...`).



### Configuration & Control Options

To ensure backward compatibility and prevent breaking downstream automated 
scripts (e.g., automated CSV parsers), the behavior should be configurable:

* **Global Feature Flag:** A config toggle in `superset_config.py` (e.g., 
`EXPORT_INCLUDE_FILTER_METADATA = True/False`) to enable/disable the feature 
system-wide.
* **Dashboard / Chart / UI Toggle:** A checkbox in the export modal or 
chart/dashboard properties (e.g., *"Include filter metadata in export"*) 
allowing authors or end users to decide on demand.
* **CSV Format Preference:** System setting to choose between bundling a ZIP 
file (two CSVs) vs. adding metadata headers in a single CSV.

### Use Case & Impact

* **Data Context & Transparency:** Recipients can immediately identify the 
parameters used to generate the report without having to log into Superset.
* **Auditability & Traceability:** Prevents misunderstandings when comparing 
exports generated with different filter combinations.
* **Backward Compatibility:** Configurable controls ensure existing automated 
integrations relying on standard CSV formats remain unaffected.

---

GitHub link: https://github.com/apache/superset/discussions/44864

----
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]

Reply via email to