We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 78c8ef2 commit b4afa29Copy full SHA for b4afa29
apps/web/src/utils/excel.ts
@@ -8,7 +8,14 @@ export function downloadExcel(filename: string, recordsExport: InstrumentRecords
8
}
9
10
export function downloadSubjectTableExcel(filename: string, records: { [key: string]: any }[], name: string) {
11
+ const sanitizedName =
12
+ name
13
+ .replace(/[\\/?*[\]:]/g, '_') // Replace invalid chars
14
+ .slice(0, 31) // Max 31 chars
15
+ .replace(/^'|'$/g, '') // Remove leading/trailing apostrophes
16
+ .trim() || 'Subject'; // Fallback if empty
17
const workbook = utils.book_new();
18
+ utils.book_append_sheet(workbook, utils.json_to_sheet(records), sanitizedName);
19
utils.book_append_sheet(workbook, utils.json_to_sheet(records), name);
20
writeFileXLSX(workbook, filename);
21
0 commit comments