MCPcopy Create free account
hub / github.com/QuarkGluonPlasma/react-course-code / main

Function main

excel-export/index3.js:4–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2const fs = require('fs');
3
4async function main(){
5 const workbook = new Workbook();
6
7 const workbook2 = await workbook.xlsx.readFile('./bundle.xlsx');
8
9 const zhCNBundle = {};
10 const enUSBundle = {};
11
12 workbook2.eachSheet((sheet) => {
13
14 sheet.eachRow((row, index) => {
15 if(index === 1) {
16 return;
17 }
18 const key = row.getCell(1).value;
19 const zhCNValue = row.getCell(4).value;
20 const enUSValue = row.getCell(5).value;
21
22 zhCNBundle[key] = zhCNValue;
23 enUSBundle[key] = enUSValue;
24 })
25 });
26
27 console.log(zhCNBundle);
28 console.log(enUSBundle);
29 fs.writeFileSync('zh-CN.json', JSON.stringify(zhCNBundle, null, 2));
30 fs.writeFileSync('en-US.json', JSON.stringify(enUSBundle, null, 2));
31}
32
33main();

Callers 1

index3.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected