Blog Post

Azure Integration Services Blog
2 MIN READ

How to send Excel file via HTTP in Logic App

Yanbo_Deng's avatar
Yanbo_Deng
Icon for Microsoft rankMicrosoft
Apr 25, 2025

Due to logic app content transfer mechanism, sending an Excel file (XLSX) in HTTP will corrupt original content format by default. This article will help you to workaround this issue by sending binary data in HTTP body instead.

In this article, we will transfer an Excel file from a OneDrive to the other OneDrive using HTTP action. It is not required to be OneDrive only, but I just used for an example. It could be SharePoint documents, SFTP server, blob storage, or any other places you prefer, which applied to both source and destination. 

 

1. The first step is retrieving file from OneDrive, and here I am using OneDrive Connector action "Get file content using path". Make sure you set "Infer Content Type" to "No". Note that, if you mark "Infer Content Type" as "Yes", it will get file content as XLSX format thus we cannot transfer it using HTTP properly; If you mark "Infer Content Type" as "No", then received content type is base64 encoded binary, and that is what we need.

 

2. Then comes to HTTP action, there are two key points here: 1) make sure we set the "Content-Type" to "application/octet-stream" which stands for binary content; 2) the POST body should be "@base64ToBinary(body('Get_file_content_using_path')?['$content'])" which converted base64 content back to binary for transferring.

 

3. The last step is receiving the content and creating the Excel file in destination. Make sure the request trigger body is purely empty to ensure binary content received. Then you can simply create ".xlsx" file with content "triggerBody()" with your appropriate name.

 

This should also apply to any other binary content transfer scenario, and hope this article could help especially when transferring cross tenants and services.

Updated Apr 25, 2025
Version 1.0
No CommentsBe the first to comment