24 lines
871 B
JavaScript
24 lines
871 B
JavaScript
const exceljs = require('exceljs');
|
|
|
|
async function main() {
|
|
const workbook = new exceljs.Workbook();
|
|
const dataBook = await workbook.xlsx.readFile('/home/kingsome/contribution072301.xlsx');
|
|
const nowTime = Math.floor((new Date()).getTime() / 1000);
|
|
dataBook.eachSheet((sheet, sheetIndex) =>{
|
|
//console.log(sheet.name, sheetIndex);
|
|
if (sheet.name == '贡献点') {
|
|
sheet.eachRow((row, index) => {
|
|
const accountAddress = row.getCell(3).value.toLowerCase();
|
|
const value = row.getCell(4).value.result;
|
|
if (accountAddress.length >= 30) {
|
|
const insertSql = 'INSERT INTO t_contribution(account_address, contribution, createtime, modifytime) ' +
|
|
"VALUES('" + accountAddress + "'," + value + ',' + nowTime + ',' + nowTime + ");";
|
|
console.log(insertSql);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
main();
|