0

I tried out this approach: link

It works fine with csv file, but i need to do the same for .xls file

In java side

public StringBuilder columnsForCsv(){
    StringBuilder result = new StringBuilder();
    List<String> columns = new ArrayList<>();
    columns.add("id");
    columns.add("from");
    columns.add("to");

    for(String column : columns){
        result.append(column + ",");
    }
    return result;
}

This code will create 3 different columns with name id from to in csv file

but when when i tried out the same for .xls file. This doesn't work.

Is there any way to write data in xls file without using any external library.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Nitin Singhal
  • 215
  • 2
  • 11
  • 1
    *"without using any external library"* just write one yourself. The only problem is that it'll take years to be of same quality as existing libraries. – BalusC May 05 '20 at 13:03
  • @BalusC, i mean to say using only libraries given by java, is it possible or not. If yes, then how to do it. – Nitin Singhal May 05 '20 at 13:08
  • 1
    .xls has been names by [apache poi](https://poi.apache.org) "horrible spreadsheet format" for good reason. .xlsx is XML, but is not simple. Better use POI. – Jonathan Rosenne May 05 '20 at 13:18
  • Certainly it's possible :) Otherwise external libraries like Apache POI didn't exist. They are usually open source, you can just take a look in their source code to learn how they did it. – BalusC May 05 '20 at 13:28

0 Answers0