Advertisement

Help To convert Excel to CSV then to binary

Started by November 18, 2019 03:50 AM
11 comments, last by ericrrichards22 4 years, 10 months ago

Why are you reinventing the wheel and don't just export the file from a spreadsheet program? CSV export is pretty standard.

On the other hand, when you read the excel file you can write the binary directly, and you don't need the CSV step anymore.

I guess the best strategy depends on whether you have to convert excel files regularly. If they are part of your workflow it could make sense to have a custom converter. But you'll want it to write out the requested format and not require an additional step.

You should really use a library like CsvHelper (https://joshclose.github.io/CsvHelper/) to do CSV parsing/writing over rolling your own. CSV is deceptively complex, and not very standardized. You can quickly run into a lot of edge cases that can be a real time sink to fight with, especially if you are then trying to open the generated CSV in Excel. Excel's csv handling can be very odd if it isn't formatted exactly as it expects.

Eric Richards

SlimDX tutorials - http://www.richardssoftware.net/

Twitter - @EricRichards22

This topic is closed to new replies.

Advertisement