### Getting cell values

Posted:

**Thu Nov 19, 2015 4:19 am**Hello. I just started learning about xlsx4j. I'm having difficulty get the values from the cells. I have a simple excel file with a few text found in the rows and columns, these are "hello" and "there".

Below is my code:

SpreadsheetMLPackage spread = SpreadsheetMLPackage.load(new java.io.File(excelPath));

WorkbookPart wbPart = spread.getWorkbookPart();

WorksheetPart wsPart = wbPart.getWorksheet(0);

SheetData sheetData = wsPart.getContents().getSheetData();

List<Row> rows = wsPart.getContents().getSheetData().getRow();

for(int i =0; i<rows.size();i++){

List<Cell> cell = rows.get(i).getC();

for(int j=0;j<cell.size();j++){

Cell c = cell.get(j);

System.out.println(c.getR() + " contains --> " + c.getV());

}

}

the result is:

A1 contains --> 0

B1 contains --> 1

A2 contains --> 0

B2 contains --> 1

A3 contains --> 0

B3 contains --> 1

A4 contains --> 0

B4 contains --> 1

A5 contains --> 0

B5 contains --> 1

Any ideas why it's returning a number rather than a text?

Thanks in advance

Below is my code:

SpreadsheetMLPackage spread = SpreadsheetMLPackage.load(new java.io.File(excelPath));

WorkbookPart wbPart = spread.getWorkbookPart();

WorksheetPart wsPart = wbPart.getWorksheet(0);

SheetData sheetData = wsPart.getContents().getSheetData();

List<Row> rows = wsPart.getContents().getSheetData().getRow();

for(int i =0; i<rows.size();i++){

List<Cell> cell = rows.get(i).getC();

for(int j=0;j<cell.size();j++){

Cell c = cell.get(j);

System.out.println(c.getR() + " contains --> " + c.getV());

}

}

the result is:

A1 contains --> 0

B1 contains --> 1

A2 contains --> 0

B2 contains --> 1

A3 contains --> 0

B3 contains --> 1

A4 contains --> 0

B4 contains --> 1

A5 contains --> 0

B5 contains --> 1

Any ideas why it's returning a number rather than a text?

Thanks in advance