web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Answered

sharepoint lactivity

(0) ShareShare
ReportReport
Posted on by 22

I'm currently working on a basic flow using Power Automate Desktop and encountering some hurdles. I'd greatly appreciate any insights or assistance regarding the following issues:

  1. Reading an Excel File Attached to a SharePoint List: I'm attempting to read an Excel file that's attached to a SharePoint list. I understand that the first step involves using the "Get attachments" action to retrieve the attachment content. However, I'm uncertain about how to retrieve and utilize the file identifier obtained from this action. Could someone provide guidance on extracting the file identifier from the result of the 'Get attachments' step and subsequently accessing the attached Excel file within my Power Automate Desktop flow?

  2. Attaching Files to SharePoint List Items: In another part of my workflow, I'm trying to attach a file directly to an item in a SharePoint list. While I've successfully managed to upload a file to a SharePoint folder, I'm encountering a "Bad Gateway" error when attempting to attach the file directly to a SharePoint list item. This error seems unusual, especially considering that I've established a connection to SharePoint and successfully uploaded a file to a SharePoint folder. Any suggestions on troubleshooting this issue would be highly appreciated.

 

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    Hi @clarkzara 

     


    1. Reading an Excel File Attached to a SharePoint List: I'm attempting to read an Excel file that's attached to a SharePoint list. I understand that the first step involves using the "Get attachments" action to retrieve the attachment content. However, I'm uncertain about how to retrieve and utilize the file identifier obtained from this action. Could someone provide guidance on extracting the file identifier from the result of the 'Get attachments' step and subsequently accessing the attached Excel file within my Power Automate Desktop flow?

     


    I have seen many folks reporting "bad gateway error" in all different cloud packages in PAD. For the above scenario I would recommend the below approach.

     

    In my list, there are two attachments under the ID 1.

    1. Initially, I utilized the 'get attachments' action and set my list ID to 1.

    2. Since there are two attachments within this specific list ID, I employed a foreach loop to iterate through all the attachments retrieved from the 'get attachment' response.

    3. Subsequently, I invoked the 'Get attachment content' action, passing the file identifier as 'Currentitem.id' as like below screenshot

    Deenuji_1-1716139200692.png

     

    1. Next, I retrieve the binary data of my attachment from the aforementioned action. As I intend to access the data within the Excel file, I recreate the Excel file using the "onedrive file create" action. Additionally, I've synchronized the same OneDrive path with my local system.

    2. Once the above action is completed, the Excel file from OneDrive becomes available on my local system as well.

    3. Subsequently, I utilize the "Launch Excel" function, passing the OneDrive folder name along with the file name to open it on my local system, enabling me to read the data from the Excel file.

     

    Deenuji_0-1716138883210.png

     


    Attaching Files to SharePoint List Items: In another part of my workflow, I'm trying to attach a file directly to an item in a SharePoint list. While I've successfully managed to upload a file to a SharePoint folder, I'm encountering a "Bad Gateway" error when attempting to attach the file directly to a SharePoint list item. This error seems unusual, especially considering that I've established a connection to SharePoint and successfully uploaded a file to a SharePoint folder. Any suggestions on troubleshooting this issue would be highly appreciated.

     


    For the above use case, solution is simple.

     

    Utilize the "Add attachment" action with the following steps:

    1. Specify the list name and its corresponding ID to which you intend to attach the file.

    2. Provide the file name.

    3. If your file is stored locally, convert it into binary format and include it as file content.

    Once these steps are completed, your file will be uploaded to the list as an attachment. That's all there is to it!

    Deenuji_2-1716139671600.png

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • clarkzara Profile Picture
    22 on at

    Thank you for your quick reply. I have a clarification: The variable produced by the "Get attachment content" action is already in binary format, correct? So, whether I create the file via OneDrive or SharePoint, there shouldn't be a need to convert it into binary again, right? However, I'm encountering an error message that says "Argument 'body' must be binary." Can you please help me understand why this might be happening and how to resolve it?Screenshot (308).png

  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @clarkzara 

     

    It appears you created your desktop flow using the Power fx enabled feature, which might cause syntax issues since it's in preview mode. I don't recommend using it for any live projects. Please disable this feature(as mentioned in the below screenshot) and create a new flow following the steps outlined above. Hopefully, this will resolve your issues.

     

    Deenuji_0-1716172855708.png

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • clarkzara Profile Picture
    22 on at

    Nice it is now working thanks. Just a quick clarification, can i use the variable created by "Create file from onedrive" for the excel to read the file?

  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @clarkzara 

     

    Please find the below reference on the raise points:

     

    This is how i am creating file 

     

    Deenuji_0-1716186198240.png

     

    While launch excel, I have hardcoded OneDrive folder path as its slightly different from above action create file "folder path" and again used same current item file name variable as file name in the document path.

    Deenuji_1-1716186272099.png

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

Under review

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.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard