0

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

3
  • Apache POI is the framework, which will be useful for you. More info: poi.apache.org Commented May 10, 2013 at 9: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. Commented May 10, 2013 at 9: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. Commented May 10, 2013 at 22:01

2 Answers 2

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...

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.