Update CSV export to use semicolons as separators for better Excel compatibility

Modify the CSV generation logic in server/routes.ts to use semicolons (;) instead of tabs (\t) as delimiters. This change addresses issues with CSV files not being properly tab-delimited in certain spreadsheet applications, particularly in French locales, ensuring each row is correctly parsed.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 833028cc-a84a-4658-a40c-0a89da3920e8
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/WZFf6za
This commit is contained in:
michaelschal committed 2025-11-04 12:36:40 +00:00
1 parent 07027d4fa7
commit be762d8240
1 file changed
+5 -5
+5 -5
View File
@@ -589,8 +589,8 @@ export async function registerRoutes(app: Express): Promise<Server> {
.filter((schedule: any) => validatedPaymentMethods.includes(schedule.paymentMethod))
.sort((a: any, b: any) => a.dueDate.getTime() - b.dueDate.getTime());
// Générer le fichier CSV avec tabulations
console.log('📄 [EXPORT] Génération du fichier CSV avec tabulations...');
// Générer le fichier CSV avec point-virgule (séparateur Excel France)
console.log('📄 [EXPORT] Génération du fichier CSV avec point-virgule...');
// Préparer les en-têtes
const headers = ['Date d\'échéance', 'Fournisseur', 'Facture', 'Mode de paiement'];
@@ -601,7 +601,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
const csvLines: string[] = [];
// Ajouter la ligne d'en-tête
csvLines.push(headers.join('\t'));
csvLines.push(headers.join(';'));
// Ajouter les données
schedules.forEach((schedule: any) => {
@@ -613,7 +613,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
];
if (includeHT) row.push(schedule.amountHT.toFixed(2));
if (includeTTC) row.push(schedule.amountTTC.toFixed(2));
csvLines.push(row.join('\t'));
csvLines.push(row.join(';'));
});
// Calculer les totaux
@@ -624,7 +624,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
const totalRow: string[] = ['', '', '', 'TOTAL'];
if (includeHT) totalRow.push(totalHT.toFixed(2));
if (includeTTC) totalRow.push(totalTTC.toFixed(2));
csvLines.push(totalRow.join('\t'));
csvLines.push(totalRow.join(';'));
// Générer le contenu CSV avec BOM UTF-8 pour Excel
const BOM = '\uFEFF';