添加路径参数

This commit is contained in:
Cheney 2024-12-12 21:08:26 +08:00
parent 29f3529143
commit 7badaae4a6

View File

@ -2,6 +2,20 @@ const XLSX = require('xlsx');
if ( process.argv.length < 3 ) {
console.log("没有传递目录")
process.exit(-1)
}
let path = process.argv[2]
console.log("工作于 " + path)
const workbook4 = (function () { const workbook4 = (function () {
const workbook = XLSX.readFile(path + '../金额.xlsx'); const workbook = XLSX.readFile(path + '../金额.xlsx');
const worksheet = workbook.Sheets[workbook.SheetNames[0]]; const worksheet = workbook.Sheets[workbook.SheetNames[0]];
@ -13,17 +27,6 @@ const workbook4 = (function () {
return map; return map;
})() })()
if ( process.argv.length < 3 ) {
console.log("没有传递目录")
process.exit(-1)
}
let path = process.argv[2]
console.log("工作于 " + path)
const workbook = XLSX.readFile(path + '/1.团队开票申请表-12.4.xlsx'); const workbook = XLSX.readFile(path + '/1.团队开票申请表-12.4.xlsx');
const worksheet = workbook.Sheets[workbook.SheetNames[0]]; const worksheet = workbook.Sheets[workbook.SheetNames[0]];
const jsonData = XLSX.utils.sheet_to_json(worksheet); const jsonData = XLSX.utils.sheet_to_json(worksheet);