From 6643e781a7bb6a2764540d45df80bad546fe8c56 Mon Sep 17 00:00:00 2001 From: w8385 Date: Wed, 17 Apr 2024 00:54:43 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B2=AB=20=EB=B2=88=EC=A7=B8=20?= =?UTF-8?q?=ED=96=89=20=ED=95=84=EB=93=9C=EB=AA=85=20=EB=B6=88=EB=9F=AC?= =?UTF-8?q?=EC=99=80=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/group/group.service.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/group/group.service.ts b/src/group/group.service.ts index 874ae46..d706189 100644 --- a/src/group/group.service.ts +++ b/src/group/group.service.ts @@ -41,12 +41,19 @@ export class GroupService { await workbook.xlsx.load(excel.buffer); const worksheet = workbook.getWorksheet(1); + + const columns = []; + worksheet.getRow(1).eachCell((cell) => { + columns.push(cell.value); + }); + const data = []; worksheet.eachRow((row, rowNumber) => { if (rowNumber !== 1) { const rowObject = {}; row.eachCell((cell, colNumber) => { - rowObject[`column${colNumber}`] = cell.value; + const col = columns[colNumber - 1]; + rowObject[col] = cell.value; }); data.push(rowObject); }