Click here to Skip to main content
15,878,602 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have an Excel file inside a Zip. In order to access the files of the zip I'm using ZipArchive and going through each entry and I want to convert the stream of the ZipArchiveEntry into a DataTable without using FileStream because I don't know the path or have any info about the file.

What I have tried:

foreach(var entry in zipArchive.Entries)
{
  using (var stream = entry.Open()){
   //here i want to convert this stream to DataTable
  }
}
Posted
Updated 17-Jun-22 9:56am
v2
Comments
PIEBALDconsult 17-Jun-22 16:23pm    
I'll have to review the code I wrote for doing that later.
It's not simple.
Oh, and XLSX is also a ZIP file, which makes it a double problem.

1 solution

An Excel file is totally different from a DataTable, so you can not read that directly.
It might be possible after converting it, e.g. with a library like EPPlus, see: best-tools-for-creating-an-excel-spreadsheet-with-c[^]
 
Share this answer
 
Comments
Richard Deeming 20-Jun-22 6:05am    
NB: EPPlus is no longer free for use in commercial applications. The repository you've linked to is a read-only archive of v4, which was the last LGPL version.
RickZeeland 20-Jun-22 6:35am    
Thanks for the info, I have updated the page on Slant.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900