c# – .NET: Import Excel files, which are a embedded in a resource file, into a dataset – Education Career Blog

I have a resource file with some embedded Excel files. How can I import these files into datasets? I found several libraries / code snippets which works for files, which are on the harddisk, but nothing if the files are part of a resource file.


You can get the file as a stream with ResourceManager.GetStream() and pass it to the “open” function in your favorite library to process Excel files. They usually support open(Stream) methods, if not, you should write the stream in a temporary file

To dump the excel lines as records in a dataset: loop into the excel rows and insert a new record by line with the desired correspondency between excel columns and datatable columns.

Leave a Comment