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

[PR] Feat/univer excel export [superset]

AliIbnBotir opened a new pull request, #45279:
URL: https://github.com/apache/superset/pull/45279

   
   ### SUMMARY
   
   Part of SIP #45265.
   
   > **Stacked on #CHART_PR (Spreadsheet chart), which depends on #45263 and #45275.** This branch contains their commits, so until they merge, please review only the last commit, `feat(chart-data): export the Spreadsheet chart to Excel with its edits`. Backend only.
   
   "Export to Excel" on a Spreadsheet chart writes the sheet as the user sees it instead of the raw query result:
   - renamed headers, formulas (with cached values), cell styles, merges, column widths and frozen panes;
   - pivot mode's stacked header rows;
   - row groups as real Excel outline groups, with Subtotals and Grand Total rows.
   
   How it works:
   - In `QueryContextProcessor.get_data`, an XLSX request whose form data has `viz_type == "univer_sheet"` goes to the new `superset/utils/univer_excel.py` instead of `excel.df_to_excel`. Every other chart takes the existing path unchanged.
   - `univer_excel.py` rebuilds the same sheet the browser shows (data area, pivot headers, groups, saved edits from `univer_workbook`) and writes it with XlsxWriter, which is already a dependency.
   - Shared formulas are moved with `openpyxl`'s formula translator. `openpyxl` was already installed through `pandas[excel]` and is now declared directly in `pyproject.toml` (`>=3.1.5, <4`). `requirements/*.txt` are updated accordingly, no new package is installed.
   - It reuses the chart-data endpoint, so permissions, row limits and config apply as before. Explore sends the current form data, so unsaved edits are exported too. Dashboards, reports and alerts use the saved chart.
   - CSV and JSON exports still return the raw query result.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   <img width="1228" height="525" alt="05-excel-export" src="https://github.com/user-attachments/assets/3cef9c18-227a-4834-af4a-dc8d78562e48" />
   _Export to Excel from the chart menu, and the downloaded .xlsx: renamed headers, header fill and the Average formulas are kept._
   
   Before: the .xlsx contained the raw query result with the original column names and no formatting, formulas or groups.
   
   ### TESTING INSTRUCTIONS
   
   Automated:
   - `pytest tests/unit_tests/utils/univer_excel_test.py tests/unit_tests/common/test_query_context_processor.py`
   
   Manual (needs the chart PR):
   1. Open a Spreadsheet chart in Explore, rename a header, colour the header row and add a formula row under the data.
   2. Chart menu → Download → **Export to Excel**. Open the file: the renamed header, fill and formulas are there, and the formulas have values.
   3. Switch to Pivot mode and export again: the stacked header rows are merged as in the browser.
   4. Turn on **Group rows by dimensions** and export: Excel shows outline groups (the 1/2 buttons on the left) with Subtotals rows.
   5. Export any other chart type to Excel: the output is unchanged.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: SIP #45265
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: [PR] Feat/univer excel export [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #45279:
URL: https://github.com/apache/superset/pull/45279#issuecomment-6168810881

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | 0a62f1d5bdb60a2081450d6f3f09af2f5e0d3a74 |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6acf7affc18ffc66300cdc55 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-45279--superset-docs-preview.netlify.app](https://deploy-preview-45279--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQ1Mjc5LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.-8x36tC0jK_ZsAo_psS2cXXTXefda8d7LBn99CR3sIY)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#q1YqKMrPLShRslJS0lFKKkrMS84AstNSE0v0S_Myy1KLdFMrklNzgGRBflEJUE1KakFOfqVnClCVWWJymnliWlqyoQWQMDMzNjBITkk2NVWqBQA) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-45279--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
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: [PR] Feat/univer excel export [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45279:
URL: https://github.com/apache/superset/pull/45279#issuecomment-6169702999

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45279?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `20.61856%` with `462 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 64.77%. Comparing base ([`7f1bfab`](https://app.codecov.io/gh/apache/superset/commit/7f1bfaba4b2968e0818d6e08e79d34ecae0bd3f1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0a62f1d`](https://app.codecov.io/gh/apache/superset/commit/0a62f1d5bdb60a2081450d6f3f09af2f5e0d3a74?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 2 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/45279?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/utils/univer\_excel.py](https://app.codecov.io/gh/apache/superset/pull/45279?src=pr&el=tree&filepath=superset%2Futils%2Funiver_excel.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdXRpbHMvdW5pdmVyX2V4Y2VsLnB5) | 20.52% | [457 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45279?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/common/query\_context\_processor.py](https://app.codecov.io/gh/apache/superset/pull/45279?src=pr&el=tree&filepath=superset%2Fcommon%2Fquery_context_processor.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHRfcHJvY2Vzc29yLnB5) | 16.66% | [5 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45279?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   > :exclamation:  There is a different number of reports uploaded between BASE (7f1bfab) and HEAD (0a62f1d). Click for more details.
   > 
   > <details><summary>HEAD has 5 uploads less than BASE</summary>
   >
   >| Flag | BASE (7f1bfab) | HEAD (0a62f1d) |
   >|------|------|------|
   >|python|7|3|
   >|postgres|2|1|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #45279       +/-   ##
   ===========================================
   - Coverage   83.29%   64.77%   -18.53%     
   ===========================================
     Files        3039     3040        +1     
     Lines      198375   198960      +585     
     Branches    46213    46338      +125     
   ===========================================
   - Hits       165235   128868    -36367     
   - Misses      29916    67182    +37266     
   + Partials     3224     2910      -314     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/45279/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/45279/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.90% <20.44%> (-0.08%)` | :arrow_down: |
   | [mysql](https://app.codecov.io/gh/apache/superset/pull/45279/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/45279/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.82% <20.61%> (-0.18%)` | :arrow_down: |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/45279/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `36.65% <20.44%> (-0.09%)` | :arrow_down: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/45279/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.90% <20.61%> (-34.01%)` | :arrow_down: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/45279/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/45279/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/45279?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


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