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 Platform Community / Forums / Power Apps / Invalid number of argu...
Power Apps
Suggested Answer

Invalid number of arguments: received 2, expected 0-1

(0) ShareShare
ReportReport
Posted on by 429
Hello All,

I'm working on a Power App that you can upload files (like Excel) and it puts the data in to a SharePoint list. I'm following Shane Young's video Power Apps import Excel to SharePoint list or any data source with Power Automate. I'm getting the following error "Invalid number of arguments: received 2, expected 0-1" where I run the flow on the OnSelect of the button. In his video, he does this on the OnAddFile of the Attachment control. The below screenshot is from Shane's video but it's where I'm getting the error. Any ideas on why and how to solve this? I greatly appreciate it!

Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    68,717 Most Valuable Professional on at
    Can you show a screenshot of the trigger in the UploadandImport flow?
     

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • nleuck_101 Profile Picture
    429 on at
    Is this what you're asking for?

  • Pstork1 Profile Picture
    68,717 Most Valuable Professional on at
    Can you also show the OnSelect you are using to Invoke the flow?  You said the screenshot you supplied was from Shane's video.
  • nleuck_101 Profile Picture
    429 on at
  • Suggested answer
    Pstork1 Profile Picture
    68,717 Most Valuable Professional on at
    I haven't watched Shane's video so I'm not quite clear on what he is doing with that code.  But I have a similar demo that uses the attachment control and a trigger configured to accept a file.  The onSelect code for my flow is below.  As you can see it includes a single file record consisting of the name from the attachment control and the Content.  This is what works for me.
     
    UploadFileFlow.Run({file: {name: First(AttachmentControl.Attachments).Name,contentBytes: First(AttachmentControl.Attachments).Value}})

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • nleuck_101 Profile Picture
    429 on at
    So this kinda works for me. The file does get added to my document library. The issue is I get an error code 504, BadGateway, Response Timeout, The server did not receive a timely response from the upstream server. My list only uploaded 256 out of the 1,004 records I have in the Excel file. Any ideas on what might have caused that?
     
  • nleuck_101 Profile Picture
    429 on at
    So this kinda works for me. The file does get added to my document library. The issue is I get an error code 504, BadGateway, Response Timeout, The server did not receive a timely response from the upstream server. My list only uploaded 256 out of the 1,004 records I have in the Excel file. Any ideas on what might have caused that?
  • Suggested answer
    Pstork1 Profile Picture
    68,717 Most Valuable Professional on at
    When you call a flow from a Power App you are calling the flow Synchronously. The app will wait for a return from the flow before proceeding. The problem is that what you are doing is taking too long and the return is timing out before it can return to the Power App.  You should break your flow up into two flows.
     
    1) The flow that uploads the file to the SharePoint document library should be the one called from the Power App.  But don't do any processing of the upload in that flow.
     
    2) Then create a second automated flow that runs when a document is created in the SharePoint document library. That will trigger when the first flow uploads the file. Have that flow do the processing of all the records. That way the app doesn't have to wait for this background processing to happen before it can continue.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • nleuck_101 Profile Picture
    429 on at
    Update. I believe part of my issue was I was hitting a Pagination limit in the List rows present in a table for my flow. I turned that on and changed the limit to 2,500. I still get the same error timeout but I did get all 1,004 records uploaded to my list.

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard