Initial commit of Vox English challenge system
This commit is contained in:
25
generate_template.cjs
Normal file
25
generate_template.cjs
Normal file
@@ -0,0 +1,25 @@
|
||||
const XLSX = require('xlsx');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const data = [
|
||||
['word', 'meaning'],
|
||||
['apple', 'n. 苹果'],
|
||||
['banana', 'n. 香蕉'],
|
||||
['persistent', 'adj. 执着的,持久的'],
|
||||
['eloquent', 'adj. 雄辩的,有口才的']
|
||||
];
|
||||
|
||||
const ws = XLSX.utils.aoa_to_sheet(data);
|
||||
const wb = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'Words');
|
||||
|
||||
const staticDir = path.join(__dirname, 'static');
|
||||
if (!fs.existsSync(staticDir)) {
|
||||
fs.mkdirSync(staticDir);
|
||||
}
|
||||
|
||||
const outFile = path.join(staticDir, 'import_template.xlsx');
|
||||
XLSX.writeFile(wb, outFile);
|
||||
|
||||
console.log('Template generated at:', outFile);
|
||||
Reference in New Issue
Block a user