Excel
A workbook built in the browser is fragile under Lightning Web Security. Use CSV or a file built on the server.
The browser file is the fragile one
Generating a spreadsheet in the browser means shipping a large script that touches APIs Lightning Web Security often blocks or distorts. A component that appears to work in a quiet trial can fail once LWS is on.
Do not plan a feature on that script. Salesforce does not support third-party libraries, and an older build is the usual reason the download breaks.
CSV
A CSV file is text. Build the string in the component, or return it from Apex, and download that. Quote any field that contains a comma, a quote, or a line break.
CSV opens in a spreadsheet application. It is enough when the reader needs rows and columns and does not need formulas or several sheets.
A file from the server
When the file must be a real workbook, build it in Apex and return it from an imperative call, or store it as a File on the record. The component starts the download. It does not assemble the workbook.
Example
javascript
function toCsv(rows) {
return rows
.map((row) => row.map((cell) => `"${String(cell).replaceAll('"', '""')}"`).join(','))
.join('\n');
}