String sourceBlobFileName = "test.xlsx" //source blob name String sourceContainerName = ConfigurationManager.AppSettings //source blob container name String connectionString = CloudConfigurationManager.GetSetting("StorageConnectionString") //blob connection string
#.MOBI FILE READER FROM MS STORE CODE#
Now from inside the main function, let us write the below code static void Main(string args) This stream of data is then passed to the ExcelReaderFactory.CreateOpenXmlReader and is finally returned as data set. The above function gets the blob's reference and using the DownloadToStream function, it downloads the blob's content to a memory stream. Var excelReader = ExcelReaderFactory.CreateOpenXmlReader(memoryStream) Nuget: Install-Package ExcelDataReader () Used open source Excel Data Reader - Read Excel files in. Using (var memoryStream = new MemoryStream())īlockBlobReference.DownloadToStream(memoryStream) Retrieve reference to a blob named "test.xlsx"ĬloudBlockBlob blockBlobReference = container.GetBlockBlobReference(filename) Retrieve reference to a previously created container.ĬloudBlobContainer container = blobClient.GetContainerReference(containerName) Retrieve storage account from connection string.ĬloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString) ĬloudBlobClient blobClient = storageAccount.CreateCloudBlobClient() Private static DataSet GetExcelBlobData(string filename, string connectionString, string containerName) / Gets the Excel file Blob data and returns a dataset Step 3: Read Excel blob file using Excel Data Reader programaticallyįire up a console application and add the below Nuget packages
Now let us upload the file in sourcecontainer. It will appear as Step 2: Upload a file in the Source ContainerĬreate an excel file (say test.xlsx) whose content is as under Open the Azure portal(), and then choose Storage Account say ContainersĬreate a source container say sourcecontainer Step 1: Create a Source Blob Container in the Azure Portal In this article we will look how we can read excel blob using Excel Data Reader. Excel Data Reader is a lightweight and fast library written in C# for reading Microsoft Excel files. Azure Blob storage is a service for storing large amounts of unstructured data.