0

I want to read excel file with aspose version 2.5, I know that in the latest version we can do this like : Workbook w = new Workbook(fileStream); Cells cells = w.getWorksheets().get(0).getCells();

I didn't found any documentation on aspose 2.5.

sabri
  • 5
  • 5

1 Answers1

1

Please see the following sample code and its sample console output. The code reads the source excel file and prints the names of cells A1 to A10 and its values.

Java

// Open the workbook with inputstream or filepath
Workbook wb = new Workbook();
wb.open("source.xlsx");

// Access first worksheet
Worksheet ws = wb.getWorksheets().getSheet(0);

// Read cells A1 to A10 and print their values
for (int i = 0; i < 10; i++) {
    int row = i;
    int col = 0;

    // Access the cell by row and col indices
    Cell cell = ws.getCells().getCell(row, col);

    // Print cell name and its value
    System.out.println(cell.getName() + ": " + cell.getStringValue());
}

Sample Console Output

A1: 13
A2: 16
A3: 87
A4: 73
A5: 69
A6: 91
A7: 59
A8: 46
A9: 82
A10: 54

Note: I am working as Developer Evangelist at Aspose

shakeel
  • 1,717
  • 10
  • 14