skip to Main Content

Below are code snippets of what I currently use to import and export Excel files. However, is it possible to make this work through an Azure Web App which is serverless?

C#

File.WriteAllBytes(@"c:tempreport.xlsx", excel.GetAsByteArray());

SQL Server

INSERT INTO Employee (FirstName, Salary)
SELECT FirstName, Salary
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
    'Excel 12.0; Database=C:TempData.xlsx', [Sheet1$]);

enter image description here

2

Answers


  1. Approach 1:

    This could be achieved using azure logics apps along with web apps.

    1. Logic apps are a server less offering from azure where you can create workflows combining different steps like connecting to database, extracting / exporting data to CSV or Excel file, upload file to blob storage or an ftp location or send it as attachment in email. You can follow steps here to create logic app.
    2. But you want to access this using azure web app. That’s also possible using https request from web app to trigger the logic apps. How part is described here.
    3. Once the data is uploaded into blob storage, you can return the file link as response to the caller.

    Approach 2:

    Another way to achieve this is by coding data extract and upload logic at db end in a stored procedure. However, your db should be either on-prem or on IAAS ( VM based ) to be able to use xp_cmdshell utility from stored procedure.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search