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

   ### SUMMARY
   
   Adds **Excel (`.xlsx`)** as an attachment format for chart-based Alerts & 
Reports, alongside the existing CSV / PNG / PDF / text options. Users can now 
pick **"Send as Excel"** in the report/alert modal and receive a formatted 
spreadsheet
   by email or Slack.
   
   This picks up and finalizes the long-stalled #19810, which was closed in Nov 
2025 due to inactivity. It resolves the two issues that blocked the original:
   
   1. **Spurious index column** — the original generated the workbook by 
re-parsing the CSV into a DataFrame and writing it locally, which produced an 
extra index column. This implementation instead fetches the **pre-rendered XLSX 
from the chart data export endpoint** (`result_format=xlsx`), so it reuses the 
exact same post-processing, `include_index` logic, and the 
formula-injection-safe `superset.utils.excel.df_to_excel` path as a chart's 
normal "Export to Excel" — no spurious column, and no duplicated logic.
   2. **Unified data fetching** — per maintainer feedback on the original PR, 
CSV and XLSX now share a single `_get_data(result_format)` method instead of 
separate per-format methods.
   
   **Key changes**
   - `ReportDataFormat`: add `XLSX` + a `tabular()` helper (`{CSV, XLSX}`).
   - `BaseReportState._get_data(result_format)`: unified CSV/XLSX byte fetch; 
adds `ReportScheduleXlsx{Failed,Timeout}Error`.
   - `NotificationContent.xlsx`; email attaches `<name>.xlsx`; Slack v1 + v2 
upload xlsx.
   - Frontend: `NotificationFormats.XLSX` and a "Send as Excel" option in both 
`AlertReportModal` and the `ReportModal`.
   - Docs: list Excel among report attachment formats.
   
   XLSX availability mirrors CSV (chart-based reports only). No new feature 
flag, config key (the existing `EXCEL_EXPORT` config is reused), or DB 
migration is required.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   <!-- Please attach a screenshot of the report/alert modal's "Content format" 
dropdown showing the new "Send as Excel" option, and (optionally) the received 
.xlsx email attachment. -->
   <img width="378" height="557" alt="image" 
src="https://github.com/user-attachments/assets/4a44c468-ae1a-438c-bcb4-4f0731911f42";
 />
   
   
   ### TESTING INSTRUCTIONS
   
   Automated:
   - Unit: `pytest tests/unit_tests/commands/report/execute_test.py 
tests/unit_tests/reports/notifications/`
   - Integration: `pytest tests/integration_tests/reports/commands_tests.py -k 
"csv or xlsx"`
   - Frontend: `npm run test -- AlertReportModal` and `npm run test -- 
ReportModal`
   
   Manual:
   1. Enable the **Alerts & Reports** feature and have a worker/beat running.
   2. Create a **Report** on a chart, set **Content format → Send as Excel**, 
add an
      email recipient, and trigger it.
   3. Confirm the email contains a valid `<report name>.xlsx` that opens in
      Excel/LibreOffice with the expected data and **no extra leading index 
column**.
   4. Repeat with a Slack recipient and confirm the `.xlsx` file is uploaded.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to