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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to send excel file...
Power Automate
Answered

How to send excel file via api and get pivot table created in power automate desktop?

(0) ShareShare
ReportReport
Posted on by 357

Hi, Team

 

I  have create API Which take excel file and return the pivot table.
how to do this in power automate desktop by using the invoke web services action.

 

We have to pass excel file in API and get result as pivot table in our system

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @Sanket1 
    Try the below link:
    https://powerusers.microsoft.com/t5/Power-Automate-Desktop/Attach-file-to-HTTP-request-body/td-p/1943985 

     

    What data type does your return web API output parameter have? Is it a DataTable?

     

    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 🚀. If you'd like to appreciate me, please write a LinkedIn recommendation 🙏

  • Sanket1 Profile Picture
    357 on at

    I am passing excel file , then python script is running and pivot table is got created

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @Sanket1 

    I apologize for the confusion. Are you saying that you were able to achieve your objective using the link provided above?

  • Sanket1 Profile Picture
    357 on at

    may be by mistakenly done , my issue is not solve 
    i want to pass excel file in api call  

    Sanket1_0-1710940690737.png

     

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @Sanket1 

    What data type does your return web API output parameter have? Is it a DataTable?
    Could you please share some screenshot of your API output(Pivot table)?

     
  • Sanket1 Profile Picture
    357 on at

    I am calling api with excel file then python script is runnig and 
    while calling excel file is not upload to the api 

     

    Sanket1_1-1710946596297.png

     

    Workflow

     

    Sanket1_2-1710946638416.png

     

     

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @Sanket1 
    I’m still uncertain on how your webapi works. Please ping me in LinkedIn.

  • Sanket1 Profile Picture
    357 on at

    I just want to upload excel file in 
    INVOKE WEB SERVICE action in Request body field 
    just let me know how to add what will be the syntax


  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @Sanket1 

    I noticed that there isn't a direct option to upload your file as a parameter in the web service invoke. I'm here to assist you with your use case using a .NET script, but I need clarification on the output datatype. Is it a DataTable, a file, or perhaps something else?

     
  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @Sanket1 
    Finally here is the solution to pass your input parameter as excel and output excel file also will be saved in your local path.

    Flow screenshot:

    Deenuji_0-1710957014055.png

     


    Code:

     

    @@copilotGeneratedAction: 'False'
    Scripting.RunPowershellScript.RunPowershellScript Script: $'''# Web API endpoint URL
    $apiUrl = \"https://localhost:44387/api/values/pivottable\"
    
    # Input file path
    $inputFilePath = \"C:\\Users\\deenu\\Downloads\\Excel A.xlsx\"
    
    # Output file path to save Excel
    $outputFilePath = \"C:\\Users\\deenu\\Downloads\\newoutputexcel.xlsx\"
    
    try {
     # Create a WebClient object
     $webClient = New-Object System.Net.WebClient
    
     # Create a new FormData instance
     $formData = New-Object System.Collections.Specialized.NameValueCollection
     $formData.Add(\"file\", $inputFilePath)
    
     # Upload the file using multipart/form-data
     $responseBytes = $webClient.UploadFile($apiUrl, \"POST\", $inputFilePath)
    
     # Save the response content as byte array to output Excel file
     [System.IO.File]::WriteAllBytes($outputFilePath, $responseBytes)
     Write-Output \"Excel file saved successfully.\"
    }
    catch {
     Write-Output \"An error occurred: $_\"
    }
    ''' ScriptOutput=> PowershellOutput

     

     


    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 🚀. If you'd like to appreciate me, please write a LinkedIn recommendation 🙏

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 632

#2
Haque Profile Picture

Haque 458

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard