Tag: apache-poi

Updating different sheets of Apache POI Workbook using multiple threads

I have a for loop which i would like to run parallelly. if (platform != null) { for (final String p : platform) { log.info(“Platform ” + p); executorService.submit(new Runnable() { @Override public void run() { // TODO Auto-generated method stub try { runService(p, config, url, title, report); } catch (Exception e) { // TODO […]

How to skip particular columns in apache.poi.xssf

I am using the below code in scala to convert xlsx file to csv. I can able read all the columns and rows, And i can able to convert the same in CSV. Here is the one question for me, While reading the column i don’t want write some of the columns in CSV(Example i […]

Shift rows Apache poi Not shifting the Drop down list in the cell

I am trying to shift the rows in excel. I am able to shift them but Drop down list is not shifting. Any Idea?? sheet.shiftRows(33, sheet.getLastRowNum(), 30)

HFFSWorkBook download(Apache POI) + servlet response

I want to download an .xls file with content in it. This is the method that I have written to process the .xls file according to my requirements and then download it. public static void readDataFromResponse(String csvData, String fileName, HttpServletResponse response) throws IOException{ if(!csvData.isEmpty()){ BufferedReader br = null; byte[] binaryData = csvData.getBytes(Charset.forName(“UTF-8”)); HSSFWorkbook workBook = […]

NPOI Reading and setting formulas

Good day, This is driving me insane. This is my first time using NPOI and I am struggling. Here is an example of the excel file i am trying to read from in short form, take note of the column letter and row numbers. Description (column C) | Count(column K) | LA | 10 (row […]

POI throws “Name is too long” Exception in setUsername method

My code like this: File file=new File(“D:\env\ldartgallery_files\upload\exhibit \external”); Assert.notNull(file, “file must not be null!”); FileInputStream fileInputStream=new FileInputStream(file); HSSFWorkbook workbook=new HSSFWorkbook(fileInputStream); When I read an excel file with POI using code “HSSFWorkbook workbook=new HSSFWorkbook(fileInputStream);”,it just throws exception below. [Caused by: java.lang.IllegalArgumentException: Name is too long: ?UV??????UaQ?0r????x????lW??b??;?n??G;_???? ??rN?,?`??;|????1??[??y?q0?=??ju?r????5e??ngaH???80 at org.apache.poi.hssf.record.WriteAccessRecord.setUsername(WriteAccessRecord.java:104) at org.apache.poi.hssf.record.WriteAccessRecord.<init>(WriteAccessRecord.java:72) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) […]

How to read super large excel file using java

I have an excel file with over 1 million rows (about 60 MB) and I want to read them using java , I have the following code to read : FileInputStream file = new FileInputStream( new File( “path/file.xlsx”)); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(0); at creating workbook line it takes forever I […]

Can not get Appache POI to read file from absolute path

//This program works as long as String excelFilePath = //”countries.xlsx” // If instead I set excelFilePath = “C:\\countries.xls” // I get the following errors: //Exception in thread “main” java.lang.NullPointerException //at ReadExcel.readFileUsingPOI(ReadExcel.java:23) //at ReadExcel.main(ReadExcel.java:15) //This is using version 13 of Appache POI //Here is the classpath I am using to compile: /*.;C:\Program Files\Java\jdk1.8.0_60; C:\Appache-POI-3.13\lib\commons-codec-1.9.jar; C:\Appache-POI-3.13\lib\commons-logging-1.1.3.jar; C:\Appache-POI-3.13\lib\junit-4.12.jar; […]

xlsx excel generation – never seen this before

Need your help here… I’ve recently worked on generation of an excel document based on xls or xlsx option. Earlier it was xls by default. However i’ve been the facing the below error w.r.to generating excel worksheet in xlsx format. Caused by: **java.lang.reflect.InvocationTargetException** SystemErr R at sun.reflect.GeneratedConstructorAccessor193.newInstance(Unknown Source) SystemErr R at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57) SystemErr R at […]

How do I sort a XSSFTable with apache poi?

I am using apache poi to modify a worksheet which contains an XSSFTable. The table has a preset order but when I modify the table the sort is not initialized automatically. How do I trigger the table to be sorted according to the original ordering?

MS Excel Spreadsheet is the best Office Software, Excel VBA and Excel Formulas make Spreadsheet work faster.