Import/Export Azure Excel file to/from Azure SQL Server in ASP.NET
- This sample demonstrates how to import the worksheet Azure Excel file blob to DB on the Azure SQL Server and how to export it from DB to Azure Excel blob.
Prerequisites:
- Microsoft Visual Studio 2015 version
- Open XML SDK 2.5 for Microsoft Office
- An Azure storage account
- Azure SQL Server
Add reference DocumentFormat.OpenXml to your project.
- Export data from DB to Azure Excel blob
- Save excel to server storage then upload it to Azure.
- Import Azure Excel file to DB
- We can't directly read excel blob data, so we have to save it to server storage, and then handle it.
- We use SqlBulkCopy to bulk insert data to db.