Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create .csv from .xls

 
Amber Vaidya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a requirement to create a .xls and a .csv file from some data.

I was successfully able to create the .xls using Apache POI and download the file on the client side using



Now, to generate the .csv file I changed the above to



The .csv file is created correctly and it opens in MS Excel.

The problem is if I open this .csv file in a text editor, it shows junk.

Can someone please tell me what am I doing wrong ? Something in POI or maybe something while setting the header ?

Don't even know if this is the right forum for this problem

Any help in this regard will be greatly appreciated.
Thanks
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
POI seems like overkill for csv files, since they ARE just text.
 
Amber Vaidya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I thought as much .. but since I am already creating the .xls file (which I need) using POI , I got lazy and decided to check if I can somehow turn the .xls to .csv

Magic ??
 
Amber Vaidya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally did it by writing some more code to create a new csv file. :roll:

Deadlines !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic