user3906011
user3906011

Reputation:

Issues in converting CSV file in to XLS

Hi all I want to convert a CSV file in to .xlsx file I write the .xls file like below.

        InputStream in = new FileInputStream("csvpath");
        OutputStream out = new FileOutputStream("xlsPath");
        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        } 

but the resultant .xls file is having file in opening. Is there any specific type of code to do this?

So is there any problem here and any suggestion to do this?

Please try to give suggestion in java only not any third party.

Upvotes: 0

Views: 201

Answers (1)

Krutik Jayswal
Krutik Jayswal

Reputation: 3175

CSV is just a text file which contains values separeted by Comma, that is why it is called csv(Comma Separated Values).If you want conversation, you will need to use apache poi library for this.

You will find below link usefull for the same

http://poi.apache.org/

https://poi.apache.org/apidocs/

Hope this helps :)

Upvotes: 1

Related Questions