开发者

Using Apache POI reading columns of a excel sheet

开发者 https://www.devze.com 2023-01-15 14:40 出处:网络
My excel sheet contains many columns and many rows. I want the program to read the contents of first column alone and display in the output.

My excel sheet contains many columns and many rows.

I want the program to read the contents of first column alone and display in the output.

Using

    for (Row row : sheet) {
    for (Cell cell : row) {
        // Printing Stuff
        }
    }

The above code prints the contents of all the cells of the excel sheet. But I want the contents of first column alone to be printed.

How to alter t开发者_Python百科he code for this? Am a beginner in java. Please help


You can try this :

for (Row row : sheet) {
    Cell firstCell = row.getCell(0);
    // Printing Stuff
}

Resources :

  • Apache POI - Row.getCell()
0

精彩评论

暂无评论...
验证码 换一张
取 消