From 8c24730e9a52dc2c8933e8d41d2f9651de48a231 Mon Sep 17 00:00:00 2001 From: liyugang <liyugang@live.cn> Date: 星期六, 16 八月 2025 11:48:55 +0800 Subject: [PATCH] 2024最后一次提交 --- src/excel-merge.mjs | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/excel-merge.mjs b/src/excel-merge.mjs index 26ce284..a33248d 100644 --- a/src/excel-merge.mjs +++ b/src/excel-merge.mjs @@ -2,29 +2,28 @@ import * as fs from 'fs'; import * as path from 'path'; -const EXCEL_FILE = "C:\\Users\\lyg\\Downloads\\book-list2.xlsx" +const EXCEL_FILE = "C:\\Users\\lyg\\Downloads\\book-list3.xlsx" const bookMap = {}; const titleList = []; -const datas = [['Title','Author','Year','Publisher','ISBN']]; +const datas = [['id', 'Title', 'Author', 'ISBN']]; const dir = "C:\\Users\\lyg\\Downloads\\booklist"; // 鑾峰彇鎵�鏈夋棩蹇楁枃浠� const files = fs.readdirSync(dir, { withFileTypes: true }); // 閬嶅巻鏃ュ織鏂囦欢 for (const file of files) { - const workSheets = xlsx.parse(path.join(dir,file.name)); + const workSheets = xlsx.parse(path.join(dir, file.name)); const sheet = workSheets[0]; sheet.data.shift(); sheet.data.forEach((row) => { - const title = row[0]; - const author = row[1] - const isbn10 = row[2]; - const isbn13 = row[3]; - const isbn = isbn13 || isbn10; + const id = row[0]; + const title = row[1]; + const author = row[2] + const isbn = row[3]; if (bookMap[isbn]) { return; } - datas.push([title, author, 0, null, isbn]); + datas.push([id, title, author, isbn]); bookMap[isbn] = 1; titleList.push(title); }); -- Gitblit v1.9.1