12

I am using superCSV to write data in csv format in my code. Its working absolutely fine and very efficiently , but now my requirement changed . I need to write multiple sheets in single xls file which is very time consuming task. So is there is any way in supercsv by which i can write multiple sheet data in single csv file and will send it to client, so that when client open this csv file in MS-Excel, he can see multiple sheets rather than me generating the excel file with with multiple sheets and sending it to client.

Thanks

user3363969
  • 233
  • 1
  • 4
  • 15

2 Answers2

28

CSV is a very simple format, and does not have the concept of a "sheet". So, no, it's not possible directly. The only thing that I can suggest is to send multiple csv files to the client, perhaps as a .zip file, and have the client unizp it and import one sheet at a time into Excel.

If you need it to open directly in the browser, you'll need to go with an xls file.

GreyBeardedGeek
  • 29,460
  • 2
  • 47
  • 67
1

Take a look at the api here.

http://supercsv.sourceforge.net/apidocs/index.html

I'm not familiar SuperCsv please don't beat me up too bad if I'm wrong... Can't you just set CsvPreference to EXCEL

nckbrz
  • 688
  • 1
  • 6
  • 20
  • 5
    The preference just sets how the quotes and delimiters are set up. It doesn't (and can't) introduce the concept of a "sheet" into the csv format. – GreyBeardedGeek Apr 08 '14 at 11:54
  • 1
    Oh, I get that. Thank you for taking the time to give me some better insight. – nckbrz Apr 09 '14 at 00:41