Upload and read excel file in GWT using java - java

I am using GWT with java. in my application i should upload excel file and should read the content of excel file and store data in entity. I have multiple columns in my excel sheet and i need to map them with my fields in the entity. please suggest me how to achieve this. for example : I have customer Names in excel sheet i need to save them in database/entity on click of button
any help.

For uploading a file you need a multipart upload form.GWT supports this with the FormPanel and the FileUpload widget.
If the server implementation is done in Java, you need an Servlet that handles the upload. Apache Commons Fileupload will help you handling the request.
As mentioned above Apache POI can help parsing the Excel document.

You can upload excel file as any file. The detailed gwt example you can find here
http://www.celinio.net/techblog/?p=1207
To read from excel you have to use Apache POI APIs for microsoft docs.
https://poi.apache.org/
You can use the following example to make yourself familiar with the excel api's
How to read and write excel file in java

Related

upload file and auto down to local for access

I'm writing a portlet web app to allow user upload a excel file, and then the backend will do the validation to the excel file and convert the content into sql statement
The back-end is using java with library aspose.cells to handle the excel access.
The problem is, how can I pass the excel to back end to access.
Now I've think of after user upload the excel file, the back end first will download the excel file to local (maybe C:\temp), and then it can directly read the excel file from C:\temp rather than server file.
But it's possible to do it?
You seem to be looking for some sample code where you may upload an Excel file and then using Aspose.Cells for Java, process this uploaded file. You may have a look at the following link where a tutorial is there for uploading files using portlets.
http://www.codeyouneed.com/liferay-portlet-file-upload-tutorial/
Once the file is uploaded, use com.aspose.cells.Workbook class object for loading this stream directly into Workbook and then process it as per your requirement.
Following is the link to sample code for loading Excel file (in stream) into Workbook object:
https://docs.aspose.com/display/cellsjava/Opening+Files+with+Different+Formats#OpeningFileswithDifferentFormats-OpeningthroughStream
Note: I am working as Support developer/ Evangelist at Aspose.

Java POI api to update excel data in background without closing excel?

Is there any way to update excel content in background when the sheet is in open state.
I am using Apache POI Spreadsheet API (java based API) to read and write content in excel sheet.
By using user API, I am saving data to excel sheet, but I didn't find any API to update excel data in background(without closing excel file, content should be updated).
If we try to update excel when it's open it'll show error like file is accessed by other resource.
Please help me to find an API to achieve this by using Apache POI or any other API.
(I observed by using VB script we can achieve this. but first preference is Java, if there is no other API available then VB Script).
Excel puts a lock on the file and thus actively prevents other applications from changing the file, so I don't think this is possible with any library.

Filter data form CSV file in java

I'm building a webapp get information from a CSV file and display it to a table. In this form have some filter component to filter information to display.
If data from database it become so easy when we using query commands but data from CSV file so i don't know way to to filter it.
Can you suggest me some way to do it, thank all.
Use Apache POI library. This library can manipulate almost all spreadsheets and the AutoFilter interface can be used to implement filters.
Useful links:
Apache POI documentation
AutoFilter in Apache POI

How to download large CSV file?

My application requires a reporting facility in excel/csv format. In case of large report, the generated CSV is corrupt. Though i am able to e-mail the generated CSV using smtp.
I tried changing the following with no lead, your help on this is appreciated
Change the library to POI
Changed the library to JXL
Monitored if there is a memory leakage
This is a web based application and the code is written in JSP.
POI is mainly for MS office formats like xls, xlsx, doc. JXL is also for xls files. You should use a framework which is for CSV like OpenCSV.

Convert Excel sheet to PDF through Java

I need to convert an excel spreadsheet to PDF file. I looked for in the Web and I found that the best way to do this is using OpenOffice API, but it is not free.
Someone know any open source library for doing this?
Any examples code is appreciating
Apache POI can read Excel. iText can write PDF.

Categories

Resources