-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunWithExcelFile.java
More file actions
28 lines (26 loc) · 1.19 KB
/
Copy pathRunWithExcelFile.java
File metadata and controls
28 lines (26 loc) · 1.19 KB
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
import java.util.concurrent.atomic.AtomicInteger;
public class RunWithExcelFile {
public static void main(String[] args) {
FastExcelReader reader = new FastExcelReader();
String filePath = "C:\\Users\\yashw\\Downloads\\fast-memory-efficient-excel-reader\\my_data.xlsx";
long startTime = System.nanoTime();
try {
// Read the Excel file and get a stream of rows
AtomicInteger i = new AtomicInteger();
reader.readExcel(filePath)
.forEach(row -> {
// Process each row
System.out.println("Row Data:");
row.forEach((columnName, value) -> {
System.out.println("Column: " + columnName + ", Value: " + value);
});
System.out.println("---- End of Row ----");
i.getAndIncrement();
});
long endTime = System.nanoTime();
System.out.println("Successfully processed " + i.get() + " rows in " + (endTime - startTime) / 1e9 + " seconds.");
} catch (Exception e) {
e.printStackTrace();
}
}
}