I have an Azure Subscription, API Management service, App Service, and Resource group.
My website allows people to upload their information in Excel spreadsheets, parses them, and then generates multiple spreadsheets from the data. That part works.
One of the outputs has to be a PDF version of each generated spreadsheet.
I've tried multiple libraries that claim to be able to export xlsx and xlsm files to a PDF but they all seem to have issues.
Libre Calc and both the desktop and cloud versions of Excel can all generate the PDF. I have a license to install Excel on another machine.
I already have C# code written that exports the PDF using Excel from my desktop. That part works.
Now I need to port that functionality to my website. My plan is to just execute my existing app from the website. So using Excel desktop seems like the easiest way to move forward.
Except that I can't figure how to install Excel into my Azure subscription.
I FTP'ed the install file to my website folder.
I can access the powershell console.
But I can't see my folders from the console.
Do I need to start all over with a VM?
If I do, can I mix the VM with the website.
How do I reach the Excel install to execute it from my app from the website?
How do I reach the uploaded files from Excel?
According to this Microsoft Q & A answer by @MughundhanRaveendran-MSFT, Installing Office suits and libraries is not supported in Azure Web app. Thus as a workaround you will need to use Microsoft Graph API for Excel. Or deploy your Web app in an Azure Windows VM server by installing an IIS Server and running your Web app on it.
Another way is to run a Trigger or Azure Function in your Azure VM that exports the Excel files to PDF and then call this Function from the Azure Web app by adding the VM and the Azure Web App in the same VNET for them to communicate with each other. Using Swagger API along with your Azure Web app might help you to call the Function API running inside your VM.
You can make use of the API here and call it inside your Azure web app code:-
var convertApi = new ConvertApi("your-api-secret");
var convert = await convertApi.ConvertAsync("xlsx", "pdf",
new ConvertApiFileParam("File", @"C:\path\to\my_file.xlsx")
);
await convert.SaveFilesAsync(@"C:\converted-files\");
Reference:-
selenium - How to connect Azure App service to Azure VM? - Stack Overflow