none
how to query excel spreadsheet already loaded in the memory as stream of bytes RRS feed

  • Question

  • Hello,

    I would like to ask if there is away to query/read excel spreadsheet, already loaded in the memory as stream of bytes, directly without saving it first as a file on the server.

    The common scenario for reading Excel spreadsheet from a .Net application is to use OLeDB provider like Microsoft.Jet.OLEDB and to query it as a database. However, the connection string requires to specify the DataSource as a file in the file system like ..DataSource = “C\Test.xls”…

    In our scenario we can get the excel data as a stream of bytes from report server web service and we would like to query it directly, without saving it to the file system first.

    I am wondering if there is a way to specify the OlEDB provider to use stream of bytes and to pass the local variable name, or if there is another API that would allow manipulating the stream of bytes as excel structure.

     

    Thanks,

    I.T.

     

    Tuesday, September 16, 2008 1:25 PM

All replies

  • Unfortunately not. If you can convert the stream of data into an in-memory data access object, such as a DataTable, then there wouldn't be any need to save to a file since you can query the DataTable. But if you can't do this then the stream will need to be saved to a file first and then read it back in using the OLEDB methods.

     

    Tuesday, September 16, 2008 1:40 PM
  • Jet or ACE providers do not support reading from the memory stream or any other stream. If you only need to read data then you could try .NET Managed Reader for Excel from my web site. It has functionality to read data from Excel file loaded into memory (or other) stream and from files. It is implemented as any other .NET managed provider, but with read-only capabilities.

     

    Wednesday, September 17, 2008 9:34 AM
    Moderator