got a fast question concerning how to read in from an xlsx file while using xssf format from Apache.
At this time my code appears like this:
InputStream fs = new FileInputStream(filename); // (1) XSSFWorkbook wb = new XSSFWorkbook(fs); // (2) XSSFSheet sheet = wb.getSheetAt(0); // (3)
With the relevant things imported. My error is the fact that after i hit run, it will get stuck at line (2), in almost an infinite loop. Filename is simply a string.
If anybody could produce some sample code regarding how to fix i would actually be thankful. all i would like at this time would be to read in one cell from an xlsx file, cause I had been using HSSF for xls files coupled with no problems. interesting help, Andrew
The reason for smashing the file into an InputStream? XSSFWorkbook includes a constructor that merely takes the road like a String. Just hard code the road from the string in. When you produce the workbook you may create XSSFSheets from that. Then XSSFCells, that will then finally permit you to browse the contents of merely one cell (cells derive from x,y locations, basically)