-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.cjs
28 lines (22 loc) · 902 Bytes
/
test.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const XLSX = require("xlsx");
const fs = require("fs");
const generateRandomData = (rows) => {
const data = [["Application ID", "Name", "Marks"]];
for (let i = 1; i <= rows; i++) {
const name = `Student${i}`;
const marks = Math.floor(Math.random() * 101); // Random marks between 0 and 100
data.push([i, name, marks]);
}
return data;
};
const createExcelFile = (data, fileName) => {
const ws = XLSX.utils.aoa_to_sheet(data);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
XLSX.writeFile(wb, fileName);
};
const numberOfRows = 200000; // Specify the number of rows you want in your Excel file
const excelData = generateRandomData(numberOfRows);
const fileName = "large_excel_file.xlsx"; // Specify the desired file name
createExcelFile(excelData, fileName);
console.log(`Excel file "${fileName}" created with ${numberOfRows} rows.`);