Below is my code which is used to read open office spread sheet data where i have 16 columns in it the problem is out of 16 columns i have 14 th column where the data cannot be empty in that 14 th column if any cell is empty i should show an error message by showing the row numbers of that column that these rows are empty please fill and if all the cells are filled in that column the data should get inserted into database how can i do this can any one help me outas i am new to this
public void readODS(File file)
{
Sheet sheet;
try
{
//Getting the 0th sheet for manipulation| pass sheet name as string
sheet = SpreadSheet.createFromFile(file).getSheet(0);
//Get row count and column count
int nColCount = sheet.getColumnCount();
int nRowCount = sheet.getRowCount();
System.out.println("Rows :"+nRowCount);
System.out.println("Cols :"+nColCount);
//Iterating through each row of the selected sheet
MutableCell cell = null;
for(int nRowIndex = 0; nRowIndex < nRowCount; nRowIndex++)
{
//Iterating through each column
int nColIndex = 0;
for( ;nColIndex < nColCount; nColIndex++)
{
cell = sheet.getCellAt(nColIndex, nRowIndex);
System.out.print(cell.getValue()+ " ");
}
System.out.println();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
public static void main(String[] args) {
//Creating File object of .ods file
File file = new File("D:\\Users\\test.ods");
OdsReader objODSReader = new OdsReader();
objODSReader.readODS(file);
}
My above code prints the spreadsheet data on the console but what i need is i need to insert the data in database if the data in 14th column is not empty if any cell is empty it should show row numbers which are empty in that column.can anyone help me out as i am learner and new to this