Two Laptop Bag*
The moose likes Java in General and the fly likes Upload Excel on desktop to JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Upload Excel on desktop to JAVA" Watch "Upload Excel on desktop to JAVA" New topic
Author

Upload Excel on desktop to JAVA

John Molitor
Ranch Hand

Joined: Nov 08, 2004
Posts: 39
I have a situation where a user fills in an excel spreadsheet and then we need to upload it from their PC into our java welboigc app running on AIX. I have heard commons file upload bantered about, requiring changing the xls to a csv document (don't want the user to have to do this). I also have heard POI mentioned as well, but not sure if POI can upload from a PC to my web app. Any suggestions?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30146
    
150

John,
POI is able to read the Excel file. It doesn't take care of actually uploading the file for you.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
subodh gupta
Ranch Hand

Joined: Jul 23, 2007
Posts: 203
Are you talking about extracting data or uploading as blob?

I think nothing is required in uploading a file you can take the path of the file and just read through any stream.

What you want do after uploading it?


http://subodh-gupta.blogspot.com
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
You can use Commons FileUpload for the server side, and Commons HttpClient for the client side. As was mentioned above, any file can be used - no conversion is necessary. See http://faq.javaranch.com/java/FileUpload for more detail.


Ping & DNS - my free Android networking tools app
John Molitor
Ranch Hand

Joined: Nov 08, 2004
Posts: 39
I am looking to do two things.
1. My webapp has an upload link, which when clicked, the user supplies a file name. Then they click upload, and I want my app to pick up the file from the specified location, which in most cases is the user's PC.
2. Once I have the excel file uploaded, I need to process the data from the file inot my application, for storage in a database.

Thanks for all the responses, but I am still not clear on what I need to do.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
For #1 you'll need a servlet that uses the FileUpload library.

For #2 you'll need either Jakarta POI or the jExcelApi library.

What do you have so far?
John Molitor
Ranch Hand

Joined: Nov 08, 2004
Posts: 39
Currently, we have a process that uses the commons-file upload library to pull a .cvs file into our webapp. There is currently a parser that was written to parse the .csv file. Can fileupload upload an .xls file, and then use poi to reconstruct the file and process the data in the cells by row?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
Yes, yes and yes.
John Molitor
Ranch Hand

Joined: Nov 08, 2004
Posts: 39
Thank you , thank you, and thank you!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Upload Excel on desktop to JAVA
 
Similar Threads
how can convert excel to pdf .
Tabular Data
Prevent multiple upload in browser
Problem in reading the excel file path from WINDOWs machine from UNIX environment
Display Excel on browser & read the edited Excel sheet using Java?