I am working in a Business Central SaaS environment and I am generating an Excel file using the standard temporary record “Excel Buffer” to build the content entirely in memory. The Excel creation works correctly and the file is generated as expected. However, after generating it, I need to send or attach this Excel file, which means I need to obtain an InStream for the generated content, for example to attach it to an EmailMessage.
The issue I am facing is that I have not found any direct way to obtain an InStream from the Excel that is produced by the Excel Buffer in this SaaS scenario. At the moment, the only approach I have found is to export the Excel to a physical file and then import that file again in order to get the InStream, but this seems inefficient.
My question is: is there any way to directly convert or access the Excel generated by the Excel Buffer as an InStream, without having to export and re-import the file? I would be very interested in any patterns, built-in capabilities, or best practices that you might be using in a Business Central SaaS environment to handle this scenario cleanly.
Thank you in advance for any guidance or suggestions you can share.
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.