JoshClose / CsvHelper

Library to help reading and writing CSV files
http://joshclose.github.io/CsvHelper/
Other
4.72k stars 1.06k forks source link

Reading/Writing to multiple sheets/a specific sheeet #704

Closed sharathsridhar closed 7 years ago

sharathsridhar commented 7 years ago

Hello,

Is it possible to read multiple sheets from an .xlsx or a .csv and load them to separate datatables ? Assuming there is a Sheet1 and Sheet2 in the csv/excel file, can I read both or a particular one ?

An extension of the same question - Can we write data from a datatable to a particular sheet of an already existing csv file? An example - Sheet 1 may have fancy formatting, pivot tables, cell merges etc and will have formulas pointing to data in sheet 2. Can we read the metadata of this file and write only to sheet 2 ?

Thank You.

JoshClose commented 7 years ago

A CSV file and Excel file are not the same thing. Excel has the functionality of exporting to a CSV file, and is able to open a CSV file and manipulate it, but they're not the same at all.

CsvHelper doesn't read xlsx files, so reading multiple sheets isn't possible either.

CSV files don't have sheets, formulas or pivot tables. It's literally Comma Separated Values. This is the format of a CSV file. https://tools.ietf.org/html/rfc4180

You'll need to find an Excel library to do the things you're looking to do.

jamesbascle commented 7 years ago

If you have money, Aspose.net is great. If not, NPOI, among others, is decent.

On Jun 19, 2017 9:50 AM, "Josh Close" notifications@github.com wrote:

A CSV file and Excel file are not the same thing. Excel has the functionality of exporting to a CSV file, and is able to open a CSV file and manipulate it, but they're not the same at all.

CsvHelper doesn't read xlsx files, so reading multiple sheets isn't possible either.

CSV files don't have sheets, formulas or pivot tables. It's literally Comma Separated Values. This is the format of a CSV file. https://tools.ietf.org/html/rfc4180

You'll need to find an Excel library to do the things you're looking to do.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JoshClose/CsvHelper/issues/704#issuecomment-309445404, or mute the thread https://github.com/notifications/unsubscribe-auth/AD_ohbIhe9u0Bm1THQSXP-dNAqBmDt3eks5sFnyKgaJpZM4N9l5V .