You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "jchong9 (via GitHub)" <gi...@apache.org> on 2026/10/15 03:36:35 UTC

[I] [SIP] Include Applied Filter Settings in Excel and CSV Exports [superset]

jchong9 opened a new issue, #45332:
URL: https://github.com/apache/superset/issues/45332

   ## [SIP] Proposal for Including Applied Filter Settings in Excel and CSV Exports
   
   ### Motivation
   
   Superset exports currently contain the resulting chart or dashboard data, but not the filter selections that produced that data. This makes exported files difficult to interpret, reproduce, or share outside of Superset.
   
   This is particularly problematic when:
   - dashboard native filters affect chart results;
   - chart-level filters affect exported data;
   - exported files are consumed by users who cannot access the original dashboard;
   - multiple exports are compared over time.
   - The current export behavior should remain unchanged by default. Users should be able to explicitly choose whether filter metadata is included.
   
   This proposal builds on the idea discussed in [Discussion #44864](https://github.com/apache/superset/discussions/44864).
   
   ### Proposed Change
   
   Add filter metadata options directly to the existing export menus.
   
   #### CSV exports
   CSV export is available for charts. The CSV menu will provide three choices:
   
   1. Without filter metadata
       * Preserves the current CSV export behavior.
   2. Include filters in metadata comments
       * Adds a metadata section at the beginning of the CSV.
       * Metadata will use a comment prefix so the data remains recognizable as CSV.
   3. Include filters as a separate file
       * Returns a ZIP containing:
         * the original CSV export;
         * a separate CSV containing the filter metadata.
    
   These options will be available from all relevant chart CSV export menus, including chart, Explore, drill-detail, and drill-by exports where applicable.
   
   #### Excel exports
   Excel export is available for dashboards and charts. The Excel menu will provide two choices:
   
   1. Without filter metadata
       * Preserves the current Excel export behavior.
   
   2. Include filters as a separate file
       * Returns a ZIP containing:
         * the original Excel export;
         * a separate Excel workbook containing the filter metadata.
   
   This will apply to dashboard data exports, dashboard image exports, and chart Excel exports.
   
   #### Filter metadata
   The metadata will include:
   - dashboard filters that affected the exported query;
   - chart filters that affected the exported query;
   - human-readable filter labels;
   - human-readable selected values or ranges;
   - the affected chart where applicable.
   
   The metadata will NOT include:
   - row-level security predicates;
   - generated SQL;
   - internal security clauses;
   - filters that did not affect the exported query.
   
   When no applicable filters exist, metadata will be omitted without causing the export to fail.
   
   Implementation will be delivered in two coordinated pull requests:
   
   1. chart CSV export support;
   2. chart and dashboard Excel export support.
   
   ### New or Changed Public Interfaces
   
   No new REST endpoints are required.
   
   Existing chart-data and dashboard Excel export endpoints will accept an optional filter-export mode. The default mode will preserve existing behavior.
   
   Potential request values are:
   ```
   none
   inline
   separate
   ```
   
   For CSV:
   - none returns the current CSV response;
   - inline returns CSV with comment metadata;
   - separate returns a ZIP containing the CSV and metadata CSV.
   
   For Excel:
   - none returns the current Excel response;
   - separate returns a ZIP containing the Excel export and metadata workbook.
   
   The following existing interfaces will be updated:
   - chart export request payloads;
   - dashboard Excel export request payloads;
   - chart export React menus;
   - dashboard export React menus;
   - chart-data response generation;
   - dashboard Excel workbook generation;
   - background Excel export task arguments.
   
   No changes are proposed to saved dashboard or chart form data, visualization definitions, Superset CLI commands, or deployment configuration.
   
   ### New dependencies
   
   No new npm or PyPI dependencies are required.
   
   The implementation will use existing CSV, ZIP, and Excel generation utilities already present in Superset.
   
   ### Migration Plan and Compatibility
   
   No database migration is required.
   
   No saved dashboards, charts, URLs, or bookmarks need to be updated.
   
   Existing exports remain compatible because:
   - the new request option is optional;
   - the default behavior remains unchanged;
   - existing clients that do not send the option continue receiving the current export format;
   - filter metadata is generated at export time and is not persisted.
   - The new ZIP responses only occur when a user explicitly selects the separate-file option.
   
   ### Rejected Alternatives
   
   No alternatives considered as of now.
   


-- 
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] [SIP-237] Include Applied Filter Settings in Excel and CSV Exports [superset]

Posted by "Madan015 (via GitHub)" <gi...@apache.org>.
Madan015 commented on issue #45332:
URL: https://github.com/apache/superset/issues/45332#issuecomment-6399841026

   Working in the same team as @jchong9. Small update to this proposal after looking closer at the code:
   
   **Excel:** instead of a ZIP with a separate filters workbook, Excel exports will get an extra "Filters" worksheet at the end of the same workbook. It keeps the filters in the same file as the data, matches the original idea in #44864, and means Excel exports keep the file type they have today (no changes to the dashboard download flow). So the Excel values are now `none` and `inline`, and `separate` is CSV only.
   
   **No filters applied:** if the user asks for filter metadata and no filters apply, the export will still include the metadata header with a line saying "No filters were applied", instead of leaving it out. That way the recipient can tell that filters were checked and none applied.
   
   **Custom SQL filters:** filters written as custom SQL by the chart's author will be listed with their SQL text, since they change the data like any other filter. SQL generated by Superset and row-level security rules are still left out.
   
   **Formula safety:** every metadata cell will go through the existing formula escaping (`escape_value` for CSV, the existing formula check for Excel), per @rusackas's note.
   
   **Exports built in the browser:** Pivoted Excel and Export Current View are built in the browser, which can't make a ZIP without a new dependency. Their CSV exports will offer only the first two options.
   
   **Very large CSVs:** CSVs of 100,000 rows or more are streamed and can't be zipped, so "Include filters as a separate file" will be greyed out for them. If the backend only decides to stream after the user picked it, the filters are written as comment lines instead.
   
   **Filters we can't check:** for dashboard charts exported as images, and CSVs that are streamed from the start, no query runs that could tell us which filters were applied. In those cases every filter on the chart is listed.
   
   **PRs:** three instead of two:
   1. chart CSV export support
   2. chart Excel and browser-built exports
   3. dashboard Excel export support


-- 
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] [SIP-237] Include Applied Filter Settings in Excel and CSV Exports [superset]

Posted by "CodingRookieA (via GitHub)" <gi...@apache.org>.
CodingRookieA commented on issue #45332:
URL: https://github.com/apache/superset/issues/45332#issuecomment-6227610994

   Hello! We are a student group from UTSC, we would like to work on this issue, can it be assigned to us? Thank you!


-- 
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] [SIP-237] Include Applied Filter Settings in Excel and CSV Exports [superset]

Posted by "sfirke (via GitHub)" <gi...@apache.org>.
sfirke commented on issue #45332:
URL: https://github.com/apache/superset/issues/45332#issuecomment-6402890165

   For the Excel export, could an option be to put the metadata in another tab of the same workbook? I don't feel strongly about the tab ordering.
   
   IMO this could replace having a separate workbook. But if having the filters in another workbook is a valuable use case to someone, my idea could be an addition.


-- 
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] [SIP-237] Include Applied Filter Settings in Excel and CSV Exports [superset]

Posted by "jchong9 (via GitHub)" <gi...@apache.org>.
jchong9 commented on issue #45332:
URL: https://github.com/apache/superset/issues/45332#issuecomment-6227861525

   Hey @CodingRookieA, we are a student group from UTSC as well, lol. Forgot to mention that in the issue, sorry about that!


-- 
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] [SIP-237] Include Applied Filter Settings in Excel and CSV Exports [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #45332:
URL: https://github.com/apache/superset/issues/45332#issuecomment-6359210663

   Heya @jchong9 and @CodingRookieA, one heads-up on the CSV inline-metadata option before you get too deep into it: `superset/utils/csv.py` already runs every data cell through `escape_value`/`df_to_escaped_csv` to guard against formula injection, so a cell starting with `=`, `@`, `+`, etc. gets neutralized before Excel/Sheets can execute it as a formula. Filter labels and selected values are exactly the kind of free-text, often user-entered strings that protection exists for, so whichever PR implements the inline-comment mode should run the metadata block through that same escaper rather than just concatenating it onto the file. Otherwise it reopens that exact hole in a new code path.
   
   On process: feel free to open a draft PR as a proof of concept any time, no need to wait on anything. But since this is an approved SIP, it should also go through the actual SIP process, not just the issue thread: subscribe to the `dev@` mailing list (send any email to dev-subscribe@superset.apache.org) and post this as a `[DISCUSS]` thread there so the wider community gets a chance to weigh in before it lands. Lazy consensus applies, so if nothing comes back within the usual window you're clear to move forward, but it needs that thread first to be official. The archive's at https://lists.apache.org/list.html?dev@superset.apache.org if you want to see how these threads usually look.
   
   Holler if you want a hand with either.
   


-- 
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] [SIP-237] Include Applied Filter Settings in Excel and CSV Exports [superset]

Posted by "plat-engineer (via GitHub)" <gi...@apache.org>.
plat-engineer commented on issue #45332:
URL: https://github.com/apache/superset/issues/45332#issuecomment-6264757790

   Hi @CodingRookieA, thanks a lot for taking it! We are facing that inconvenience quite often in our daily work. Really looking forward for that feature.


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