Brainser
Brainser

Reputation: 149

import excel file in JTable using java

I want that when button is clicked using JFileChooser, filedialog need to be opened and when excel file is selected it need to be loaded in JTable can anyone please help how to import excel file into jtable?

Upvotes: 2

Views: 11023

Answers (1)

Alpesh Gediya
Alpesh Gediya

Reputation: 3794

Here are some use useful links/tutorial for you to use.

Importing Excel (.xls) in Java Swing application

blog

There are a couple of open source libraries which you can use to read an excel file such as Apache POI.

Once you've read your excel file into some data structure, this can be written into a DataModel for a JTable. Alternatively, you could write a custom DataModel which will read dynamically from the excel file, but I'd take the two steps separately and build up the complexity once you understand the excel file reading library you choose.

Upvotes: 2

Related Questions