Home » excel » java – Is it more efficient to read from an Excel file or an CSV file?

java – Is it more efficient to read from an Excel file or an CSV file?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I need to write a quick program (using Java since its the only language I am really comfortable with) that takes an Excel file (or CSV) and parces through the data adding information that might be missing.

The problem Im having is that I cant decide how to start, it feels like manipulating an Excel file would be easier but reading through a CSV file would be really simple.

Any insight on problems that might come up or maybe a third solution that I’m ignoring.

The excel document is basically just a mini audited database of printer IPs, names, manufacturers, and locations.

Edit: General consensus seems to be that CSV is a lot more easy to manipulate and since Im wanting to write a quick script that can be ran I think downloading the extra library for excel manipulation would be a hassel.

Going to start writing the code today or monday, will probably have more questions later in the week. Thank you everyone for your help! Venturing into new territory with my first job.

How to&Answers:

If reading a CSV is an option in your situation, I would definitely go for it, because you can do it in a way that is both system-independent and portable without using external libraries.

As far as the efficiency goes, the timing is very likely going to be I/O dominated, so the smaller the file – the faster you are going to read it in.

Adding the missing information and writing the file back may be a bit tricky because of the need to properly handle quotes, but it is still a lot simpler than accessing an Excel file through a special-purpose library.

Answer:

CSV willl be easier since you do not need any additional libraries like jxl. Refer to this read and write CSV tutorial

Answer:

500×10 is really quite small so difficult to imagine a lot of code would be required. If sticking with Excel its inbuilt features (Find/Replace, Sort, Filter, PivotTable, Copy down etc) I would expect to be sufficient.