First of all thanks for the previous help. What I want to do is the following. Is to collect information through a small program that can capture in Java and writes it to a file which I have done. Then to have this information passed to a preformatted excel spread sheet. In the spread sheet it reads this data that is written and displays it in different tables and graphs. Is this possible to automatically code or do I have to write to a csv file, from the csv file manually copy to an excel template? If anybody has come across a solution to my problem I would appreciate a steer in the right direction
Asked
Active
Viewed 5,985 times
0
-
`Apache POI` is the framework, which will be useful for you. More info: http://poi.apache.org – Konstantin Yovkov May 10 '13 at 09:30
-
The title of this question asks something completely different to your actual question, and left me wondering how one would even think of trying to convert a java source file to a spreadsheet. – ldam May 10 '13 at 09:40
-
What it is, I have to collect information within a small office that is not being collected by there database. The problem is that none of them are technical in the extreme but there are 5 of them logging information which is written and working to a small database. The manager can bring it all together which is working and I can produce the required information to a csv file. I have created an excel template which they can then send to the boss and other people within the company. Currently they have to copy & paste the csv file contents into the to template, I would like to automate. – Keith Spriggs May 10 '13 at 22:01
2 Answers
1
Hey try ths code in servlet or in JSP. This will convert simple excel sheet on which you can do further operations..
response.setContentType("application/vnd.ms-excel");
PrintWriter out = response.getWriter();
try {
out.println("\tId \tName");
out.println("\t1\tabc");
out.println("\t2\txyz");
out.println("\t3\tpqr");
} finally {
out.close();
}
here ..
response.setContentType("application/vnd.ms-excel");
specify the excel sheet to be generated.. all "\t" separates new cell in the excel sheet.
On your requirement basis you can also change this code with database or any...

Bhushankumar Lilapara
- 780
- 1
- 13
- 26
0
It's a duplicate of How to read and write excel file in java
you can use this API: http://poi.apache.org/
Or if you write one text file with tab separation between fields and save with (.XLS) extension, excel should read it. But off course the better solution is to use Apache POI HSSF.

Community
- 1
- 1

Ricardo Cacheira
- 797
- 4
- 6