I need to create an excel file with simple text data. Concretely, it will allocate a list (one per cell) of email addresses. Data volume will be aprox 200000, so, I want to format it in, at least, 4 sheets (same book). This is because I need to be able to open the file in old Excel versions (max 65536 rows per sheet).
Due to simplicity of data (with no charts, neither functions, etc.), I can use many APIs. Few years ago I used Apache POI to manage excel files with nice results, but I think that is too heavy (1,7MB for version 3.7) and I want to know if there is other APIs less heavy.
Also, i would like it would be available in Maven repository.
Thanks in advance.
JExcelAPI is your friend here. All fully Mavenised and ready to go.
Not directly an answer but this page seems to have some good information in comparing the different solutions. Gary's suggestion in JExcelAPI and ApachePOI are both presented along with a few more
Related
My questions is rather theoretical. I need to implement an application that takes different file extensions such as [asp,bmp,doc,docx,html,jpg,pdf,pdf,png,pptx,sql,txt,xls,xlsx] and converts them all into a consecutive PDF file for print.
I did my research in terms of coding and found multiple libraries that do the job
such as Apache POI, iText, aspose.pdf.jar and others I tested them out on individual portions of the idea. They work great but require a lot of women-hours to implement the desired application. My question is, is there anything more complete that will speed up the job. For example a library such as apache POI that does not require specifying every single padding and background color.
Any suggestions are appreciated.
As per my knowledge and experience not a single API is present there who provide all solution without this. Because of that we need to use Apache POI, iText, aspose.pdf.jar , FOP.
In java(using jquery as per my knowledge) you are able take snapshot of rendered page using stream which you will need to proceed at serverside and generate PDF which generate pdf file same like html page without any extra formatting but it having limitation that you can't use landscape. If page data is big then it shrinks pdf which causes small font(in very large page even you unable to read pdf).
Some legacy software relies on downloading multiple Excel files, merging the contents, sending it back out, someone far away making some changes to it, and then sending the modified Excel file back, where the next day the multiple Excel files will be downloaded again and merged with this file. Is there some tool (preferably for Java or that can be used from a Java program) that would allow me to replace this legacy code, as maintaining/extending it is only slightly preferable to self immolation?
I should add that the reason we're using Excel at all rather than a database is that some of the reports can only be exported as Excel, and on our end some of the staff are comfortable with using Excel formulas. So we would need something that they can edit in an Excel like way but that we can do all the above to otherwise.
Update: These files contain no images, just normal Excel data and formulas. I'm leaving "sending" generic because that can be changed pretty easily. It could be by FTP, by email, by web form, etc., doesn't really change the nature of the process.
Google Docs' spreadsheets should be considered.
If you're looking for a library for reading and writing excel files, take a look at http://jexcelapi.sourceforge.net/
has anybody found a library that works well with large spreadsheets?
I've tried apache's POI but it fails miserably working with large files - both reading and writing. It uses massive amounts of memory leaving you needing a supercomputer to parse or create a 20+mb spreadsheet.
Surely there is a more memory efficient way and someone has written it?!
#pstanton..
I was working on a similar solution and was able to write large excel 2007 files with hundreds of rows exported from database. Here is the link to it:
http://vikramvkamath.blogspot.com/2010/07/writing-large-excel-files-excel-2007.html
My solution is an extension on Yegor Koslov's SheetWriter class follow this http link and it works very well for me.
Let me know in case you face any issues.
~Vikram
I cannot really recommend a library to you. But when you need the best performance, it might be worth a try to go to the people who came up with Excel in the first place. I guess the APIs that are available from .NET are much more efficient in handling Excel files. So the idea would be to implement a web service or similiar component in .NET that does most of the Excel-related grunt work for you and just invoke that from Java.
This is basically the same idea as Jannik's, but you use the Java COM Bridge to access the Excel APIs directly from Java. We have had good success doing this with Word. Obvious downside is that it only works on Windows.
Have you tried JExcelAPI as an alternative to POI ? I confess I can't comment on it's memory efficiency.
at time of posting, there is no pure java scalable solution for reading and writing large excel files.
May be CSV file format can help you. You just need to seperate each value by comma and save file with .csv extension.
Hi I'm looking to parse spreadsheets (xls/ods) in Groovy. I have been using the Roo library for Ruby and was looking to try the same tasks in Groovy, as Java is already installed on a development server I use, and I would like to keep the number of technologies on the server to a simple core few.
I am aware that the ods format is zipped XML, and so can be parsed as such, but I would like to process the file using spreadsheet concepts, not XML concepts.
The ability to process xls files is not of major importance, but would save me having to save multiple xls files to ods (as this is for parsing data from clients).
Thanks
I would suggest Apache POI for access to .xls files.
I've never had to work with the .ods format, so no information on that one.
There's also JExcelAPI, which has a nice, clean, simple interface (for the most part).
Can't help you with ODS Files though.
How about looking at 'odftoolkit' ? http://odftoolkit.openoffice.org/
Groovy in Action has a chapter named "Groovy on Windows" that discusses using Scriptom, a Groovy/COM bridge (using JACOB under the covers), to access several Windows apps including Excel.
For OpenOffice, you can use ODF Toolkit, as Amit pointed out.
I second jdmichal's vote for Apache POI. I have selected it as our library of choose to handle Excel file input (.XLS). The project is also working on the .XLSX file format if you ever decide you want to support that. Based on your specifications, I don't think you want to get into converting things into CSV and it seems like you have established input and output paths. For anyone who hasn't had the joy of dealing with CSV to Excel conversion, it can get a bit dicey. I have spent hours dealing with issues created by Excel converting string data to numeric data. You can see other testimonies to this effect on the POI Case Studies page. Beyond these issues, I simply don't want to personally have to handle these inputs. I'd rather invest the programming effort and streamline the workflow for the future.
I too have not dealt with ODF and have no plans to support it in my current project. You might want to check out the OpenOffice.org ODF Toolkit Project.
Good luck and have fun,
- D.
I suggest you to take a look at SimpleXlsBuilder and SimpleXlsSlurper, both are based on apache POI and can fit your basic needs for reading from and writing to Excel 97 spreadsheets in a concise way.
If your spreadsheets are simple enught - without charts and other embedded contents - you should simply convert the spreadsheet to CSV.
Pros:
Both xls and ods will produce the same CSV - You'll have to handle just one input type.
You won't have to mess with new versions of (Open) Office.
Handling plaintext is always more fun than other obscure formats.
Cons:
One that I can think of - finding a reliable converter from xls and odf to csv. Shouldn't be too hard - OpenOffice has a built in one.
A couple things:
1) I agree that using a CSV format can simplify some of the development work. OpenCSV can help with processing CSV files. There are other good CSV parsers for Java out there. Just remember that anything that's available for Java can be used by Groovy due to Groovy's unparalleled integration with Java.
2) I know you said you wanted to avoid handling XML, but Groovy makes XML processing exceedingly simple.
We've pre-defined Excel document structure with lots of formulas and macros written.
During download of Excel, thru Java application we populate certain cells in Excel with data. After download when user open Excel, macros & formulas embedded in it will read the pre-populated data and behave accordingly.
We are right now using ExtenXLS to generate Dynamic Excel document from Java. Licence is CPU based and it doesn't support Boxes with Dual core CPU. We are forced to buy more licence.
Is there any better tool we can look at it which is either free, product and support cost are minimal (Support is must), licence is simple?
I quite liked using the Apache POI Project HSSF library (http://poi.apache.org/) - it was fairly easy to use. I didn't use it in that much depth, but it seemed fairly powerful. Also, there's JExcelAPI (http://sourceforge.net/projects/jexcelapi/) which I've not used.
If your users will have a recent version of Excel, it isn't too hard to tweak the XML file format by hand. Just save an existing document as XML, and find the places you want to replace.
I work on an open source project called XLLoop - this framework allows you to expose POJO functions as Excel functions.
So, instead of populating the excel sheet with data you could create a function that downloaded the data and have it populate in place.