bito-code-review[bot] commented on PR #42601:
URL: https://github.com/apache/superset/pull/42601#issuecomment-5125475930
<!-- Bito Reply -->
The flagged issue is correct. Using `raw: true` in `utils.table_to_book`
forces all cells to be treated as strings, which prevents Excel from
recognizing numeric values for sorting or calculations. To resolve this, you
should selectively apply `raw: true` only to cells that require it (e.g., those
with locale-specific formatting) while allowing SheetJS to infer types for
standard numeric cells.
Since the current implementation uses `table_to_book` on the entire DOM
element, a more robust approach is to manually construct the workbook data by
iterating over the table rows and cells, applying `raw: true` only when the
cell content matches a locale-formatted pattern, or by using SheetJS's
`cellDates` and `cellNF` options if applicable. Given the current structure,
you could also post-process the generated workbook to update the cell types
(`t`) and values (`v`) for numeric cells.
**superset-frontend/src/utils/downloadAsPivotExcel.ts**
```
const workbook = utils.table_to_book(table, {
raw: true,
cellDates: true,
cellNF: true
});
```
--
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]