Retrieve Excel Sheet data into Sqlite Database And

2020-07-30 01:50发布

In Android application ,i should get large datas(nearly 500 coloums and 1000 rows) from Excel Sheet into Sqlite Database. For that i have used the following code snippet,

    FileInputStream is = new FileInputStream("Excel File Path in SDCard");
    HSSFWorkbook  wb = new HSSFWorkbook(is);
    HSSFSheet sheet = wb.getSheet("Test");

    Iterator<?> rowIterator = sheet.rowIterator();
    int index = 0;
    while (rowIterator.hasNext()){

         HSSFRow hssfRow = (HSSFRow) rowIterator.next();
          if(index++ != 0){

             //In this stage i have storing each cell into database
              util.inserrDataToSqliteDb(dbManager, hssfRow.getCell(1).getStringCellValue(),
   hssfRow.getCell(2).getStringCellValue()  
    }
 }

When use this code it takes long time to get data from excel sheet. Taking all the rows without any iteration into database may be a good idea. But i could not get any reference to do that one.

Any suggestions ?

Thanks,

0条回答
登录 后发表回答