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

Function main

excel-export/index.js:3–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1const { Workbook } = require('exceljs');
2
3async function main(){
4 const workbook = new Workbook();
5
6 const worksheet = workbook.addWorksheet('guang111');
7
8 worksheet.columns = [
9 { header: 'ID', key: 'id', width: 20 },
10 { header: '姓名', key: 'name', width: 30 },
11 { header: '出生日期', key: 'birthday', width: 30},
12 { header: '手机号', key: 'phone', width: 50 }
13 ];
14
15 const data = [
16 { id: 1, name: '光光', birthday: new Date('1994-07-07'), phone: '13255555555' },
17 { id: 2, name: '东东', birthday: new Date('1994-04-14'), phone: '13222222222' },
18 { id: 3, name: '小刚', birthday: new Date('1995-08-08'), phone: '13211111111' }
19 ]
20 worksheet.addRows(data);
21
22 workbook.xlsx.writeFile('./data.xlsx');
23}
24
25main();

Callers 1

index.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected