File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Import data from Excel and Print in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Import data from Excel and Print in Servlet" Watch "Import data from Excel and Print in Servlet" New topic
Author

Import data from Excel and Print in Servlet

Aniketh Narayanan
Greenhorn

Joined: Jan 05, 2013
Posts: 12
Hi,

I am currently working on a project where i have to import data stored in excel sheet and print it as an output using Servlets.

I am using the POI library for exporting data. But I also need to import.

I have no idea how to write the code.

Please help.

Thanks.
Niraj Jha
Ranch Hand

Joined: Feb 20, 2013
Posts: 63

Check documentation:
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
Niraj Jha wrote:Check documentation:

Why do you recommend the low level API? POI has perfectly fine high level APIs.

But let's take a step back: You said you need to import data from Excel, and then print it. So what do you mean by "I am using the POI library for exporting data." - what is the "export" step that you already have?

But regardless, the POI web site has many, many code examples for doing just about anything related to XLS and XLSX files.


Ping & DNS - my free Android networking tools app
Aniketh Narayanan
Greenhorn

Joined: Jan 05, 2013
Posts: 12
Ulf Dittmer wrote:
Niraj Jha wrote:Check documentation:

Why do you recommend the low level API? POI has perfectly fine high level APIs.

But let's take a step back: You said you need to import data from Excel, and then print it. So what do you mean by "I am using the POI library for exporting data." - what is the "export" step that you already have?

But regardless, the POI web site has many, many code examples for doing just about anything related to XLS and XLSX files.




There was a part in the project which required acquiring data from the database and exporting it in excel sheets.
That is where i used the POI library for exporting.

But now i want to import data from excel and print it.

Can you help me with the code ???
T Mishra
Ranch Hand

Joined: Apr 04, 2006
Posts: 108

This should help you


Thanks,
Tushar (SCJP 1.5)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
As I said, the POI site has tons of examples for doing just about anything involving Excel files; have you looked through the "Quick Guide" and "HOWTO" pages?
Aniketh Narayanan
Greenhorn

Joined: Jan 05, 2013
Posts: 12
T Mishra wrote:This should help you



Thanks, it works like a charm...


thanks a lot
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
Be aware that that code only works for XLS files, not XLSX files. If you want something that works for both files, you should use the org.apache.poi.ss.... packages instead of the org.apachepoi.hssf... packages; the code shouldn't be hard to refactor.
Aniketh Narayanan
Greenhorn

Joined: Jan 05, 2013
Posts: 12
Ulf Dittmer wrote:Be aware that that code only works for XLS files, not XLSX files. If you want something that works for both files, you should use the org.apache.poi.ss.... packages instead of the org.apachepoi.hssf... packages; the code shouldn't be hard to refactor.



Oh okk. I didnt test it with a XLSX file. I shall refactor the code .

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Import data from Excel and Print in Servlet
 
Similar Threads
import excel data into mysql database?
Write Arabic text into CSV file
Print JTable problem
Copy excel file to access table
Excel - IOException Invalid Header signature