excel-import

Time efficient program for importing an excel sheet and then storing it into DB in servlet

情到浓时终转凉″ 提交于 2020-01-16 08:19:10
问题 I have written a code to import .xls and store the data into db. It works fine for small amount of data i.e some hundreds of rows of excel. But if the .xls has say 5000 rows, the importing and storing takes about 1.5 - 2 minutes. Here is the piece of code: sql = new StringBuffer("insert into bookdetails(bookno"); for (int i = 0; i < header.length; i++) sql.append("," + header[i]); sql.append(") values(?"); for (int i = 0; i < header.length; i++) sql.append(",?"); sql.append(")"); System.out

How can i get actual used range for modified excels using Epplus?

泄露秘密 提交于 2019-12-21 07:15:13
问题 I am reading data from excel to datable using EPPlus. After reading an excel sheet with 10 rows of record, I modified the excel sheet by removing existing data and kept data for only one row. But when I am reading the modified excel it still reading 10 rows (1 with value and remaining as null fields) to data table. How can limit this? I am using following code for reading Excel. using (var pck = new OfficeOpenXml.ExcelPackage()) { using (var stream = File.OpenRead(FilePath)) { pck.Load(stream

How can i get actual used range for modified excels using Epplus?

混江龙づ霸主 提交于 2019-12-04 23:34:43
I am reading data from excel to datable using EPPlus. After reading an excel sheet with 10 rows of record, I modified the excel sheet by removing existing data and kept data for only one row. But when I am reading the modified excel it still reading 10 rows (1 with value and remaining as null fields) to data table. How can limit this? I am using following code for reading Excel. using (var pck = new OfficeOpenXml.ExcelPackage()) { using (var stream = File.OpenRead(FilePath)) { pck.Load(stream); } var ws = pck.Workbook.Worksheets.First(); bool hasHeader = true; // adjust it accordingly(this is