Skip to main content

Notifications

Community site session details

Community site session details

Session Id : blActVWWuBl7T662avxBZ3
Power Automate - Power Automate Desktop
Unanswered

Upload files to a website in a loop?

Like (0) ShareShare
ReportReport
Posted on 24 Sep 2021 12:24:27 by 387

Hi fellow Power Automate Desktop veterans,

 

Is there a way that I can use Power Automate Desktop to upload files to a website?

 

Here's the steps in writing:

1. All files to be uploaded are saved in a SharePoint Document Library. Or I can download them to my PC as local files, if required.

The library structure is as follows:

My Document Library  (500+ files in total)

>

X1230.xls

X1231.xls

X1232.xls

...
   >SubFolder X1233

X1233_1.xls

X1233_2.xls

...

   >SubFolder X1234

X1234_1.xls

X1234_2.xls

...

X1235.xls

...

Each file name contains the unique file number e.g. X1233.xls

 

2. Go to the website where I want to upload the file(s) to an intranet

3. Search and open record using the unique file number X1233

Australia_1-1632484771850.png

4. Enter file name: '2020 Report'   (this is a fixed value for all file)

5. Click  File to upload (choose File X1233.xls)

6. Select type of File: Option 1 (this is a fixed option)

7. Click the 'Upload' button to upload file

8. Repeat the steps above for all other files in a loop until each file has been uploaded.

 

Many thanks.

 

  • Identity47 Profile Picture
    8 on 26 Aug 2023 at 12:19:06
    Re: Upload files to a website in a loop?

    Hi @Australia 

     

    I do not know if you ever got your PAD workflow to actually function as intended. 

    I tried to do something similar where I had to upload pictures from my desktop to a Facebook chat message.

     

    Instead of using the press button in window function, I used the Send Mouse Click function, as I was unable to get the Press button in window function to actually press the button (it did navigate to the right location, but it just did not press the button in the Facebook chat window - might be due to the way the Facebook chat buttons work, and not the Press button function malfunctioning)

     

    For the reiteration through all of the files, I used:

    1) Get files in folder (inserted before the loop - so it creates an index of the relevant files)

    2) For each loop (for each current item in the folder (the variable from the get files function))

    a) insert the relevant Press button or Send Mouse click functions to get the dialog box where you need to input the file name

    b) Use the Send Keys function and insert the %Currentitem% variable as the text to insert. 

     

    Then the workflow should insert a text consisting of:

    Folder path\file name

     

    ----

     

    Anyway, I just thought that I would share it in case you have not yet gotten your workflow to function properly or in case anybody else could use it for a workflow. 

  • VJR Profile Picture
    7,635 on 28 Sep 2021 at 05:12:51
    Re: Upload files to a website in a loop?

    Hi @Australia 

     

    For No 1. Unable to select the desired file name and file in a loop - currently both are fixed value.

     

    If you need the full path of the file there, then use %CurrentItem%
    But if you need only the filename then use %CurrentItem.Name%

     

    If you scroll to my posts above this is the part where I explained how to get each file in folder

    Click the yellow button to select %CurrentItem%. You will find %CurrentItem.Name% under the same yellow button

     

    (Below is just an example of Display Message)

    VJR_0-1632805294143.png

     

     

     

     

     

     

     

    For 2. Unable to upload a file due to a.) 'Choose File' button appears to be an image, b.) a pop up window and c.) a pop up message

     

    Firstly don't forget to add Wait actions between all  other actions

    Use 2 to 3 seconds or depending upon the speed you are seeing.

    We should give it some time to complete one action and to go onto the other.

     

    VJR_2-1632805557654.png

     

     

    If this is a web application right click on that image and click Inspect. See which html element does it show, image or button or something else.

    VJR_3-1632805826920.png

     

    For the Ok button and the Open button you will need to detect and add them as an UI element same as the other elements and click on them. It requires some playing around too with the selectors of the UI element. Ticking one and unticking the other and so forth.

     






    -------------------------------------------
    Help fellow beings find relevant posts.
    Upvote to a supporting response.
    Mark as solution to an answer.

  • Australia Profile Picture
    387 on 27 Sep 2021 at 14:08:16
    Re: Upload files to a website in a loop?

    Hi @VJR,


    I think I have finally completed the process and I feel I am almost there.

    But issues I still encounter:

    1. Unable to select the desired file name and file in a loop - currently both are fixed value.

    See Step 7 and Step 17

    2. Unable to upload a file due to a.) 'Choose File' button appears to be an image, b.) a pop up window and c.) a pop up message

    See Steps 16-21

     

    Could you please guide me to the end of the tunnel?

     

    My flow:

    flow1.jpg

    Step 7 - how to open record by searching file name in a loop - X1230, X1231 ....

     

    Australia_1-1632751559287.png

    Step 16 - 'Choose File' appears to be an image because 'Press a button' was not found if I chose to use UI or Web Automation 


    flow2.jpg

    Step 17-21  Pop up window occurs

     

    flow3.jpg

    open window.jpg

    Step 17 - To select the file for upload. (A pop up window after clicking the 'Choose File' image/button?)
    Step 18 - to click the 'Open'

     

     

     

    popupOK.jpg

    This is the Pop up window after selecting the file to upload (step 21)

     

     

    Your help is greatly appreciated.

  • VJR Profile Picture
    7,635 on 27 Sep 2021 at 08:03:56
    Re: Upload files to a website in a loop?

    Hi @Australia 

     

    Use the sequence of steps in my post above. 

     

    1. Get Files from folder Video

    2. Launch your website in a browser (explained in above video links)

     Use "For each" action here to go through each file in that folder as shown in above post.

     

    3. Perform below steps (explained in above video links)

    1.  Search and open record using the unique file number X1233 (file details from variable inside the loopVJR_0-1632729739773.png

       

    2. Enter file name: '2020 Report'   (this is a fixed value for all file)
    3. Click  File to upload (choose File X1233.xls)
    4. Select type of File: Option 1 (this is a fixed option)
    5. Click the 'Upload' button to upload file

              

    4. Use "Go to Webpage" action to go back to the same url .

    Since you are already inside the loop, the steps from 3 will automatically run one after another.

     

    When the loop is complete all the files will have been uploaded.

  • Australia Profile Picture
    387 on 27 Sep 2021 at 06:32:15
    Re: Upload files to a website in a loop?

    Hi @VJR,

     

    I've started working on my very first RAD project following the videos you gave me. 🙂 

    It has been quite fun. 🙂 Kindly see below where I am up to.

    I unfortunately still don't quite get the Loop concept and please be patient with me.

    Where would you recommend to insert the Loop function in my incidence and how do I search the file name in a loop?

    Australia_0-1632724156435.png

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Thanks again,

  • VJR Profile Picture
    7,635 on 26 Sep 2021 at 08:59:25
    Re: Upload files to a website in a loop?

    By loop I mean the "For each" to iterate through files in folder

     

    VJR_0-1632646335649.png

    I have used .txt. It will be .xls in your case

    Also I have used Display Message just to show you the file name displayed. You can at first try this just to see how it is picking the names in the folder.

     

    I have below files in a folder

    VJR_2-1632646481857.png

     

    Click the yellow button to select current item

     

    VJR_1-1632646457639.png

     

    This will display all files one after the another in a loop inside a message box.

    VJR_3-1632646624949.png

     






    -------------------------------------------
    Help fellow beings find relevant posts.
    Upvote to a supporting response.
    Mark as solution to an answer.

  • VJR Profile Picture
    7,635 on 26 Sep 2021 at 03:56:31
    Re: Upload files to a website in a loop?

    Hi @Australia 

     

    Until you provide an answer to the other post about the right tool you want to use, lets start from Step 2.

     

    Whether you downloaded the files manually or automatically via Cloud Flow Sharepoint connector, in either case lets assume you have the files saved in one folder with valid names.

     

    You can get started by placing 2-3 files manually in some folder having correct names.

     

    Before you start the mentioned steps go through the below video links in sequence.

    That will give full clarity on how and what needs to be done.

    Power Automate Desktop : Automation With UI Elements

    Extract data from web page | Web Data Extraction | Part 1

    Web Form Filling - Textbox, Dropdown, RadioButton, Checkbox Part 2

     

     

     

    1. Get Files from folder Video

    2. Launch your website in a browser (explained in above video links)

    2. Use Loop action to go through each file in that folder

    3. Perform below steps (explained in above video links)

    1.  Search and open record using the unique file number X1233 (file details from variable inside the loopVJR_0-1632628088084.png
    2. Enter file name: '2020 Report'   (this is a fixed value for all file)
    3. Click  File to upload (choose File X1233.xls)
    4. Select type of File: Option 1 (this is a fixed option)
    5. Click the 'Upload' button to upload file

              

    4. Use "Go to Webpage" action to go back to the same url .

    Since you are already inside the loop, the steps from 3 will automatically run one after another.

     

    When the loop is complete all the files will have been uploaded.

     

     






    -------------------------------------------
    Help fellow beings find relevant posts.
    Upvote to a supporting response.
    Mark as solution to an answer.

     

     

  • Australia Profile Picture
    387 on 25 Sep 2021 at 12:48:59
    Re: Upload files to a website in a loop?

    @VJR thanks for the reply.

    I'd like to get some ideas from veterans like you, how would you start a project like this?

    Would you download everything to my PC and manually fix the file names so they have the same naming convention?

     

    How should I tackle step 2 and beyond? Do you use the Record button in PAD and use a .csv to start the loop like iMacro or Selenium?

     

    Cheers,

  • VJR Profile Picture
    7,635 on 25 Sep 2021 at 11:13:58
    Re: Upload files to a website in a loop?

    HI @Australia 

     

    PAD does have the capability to do the steps you have described, so it appears doable. 

    Perhaps you can start and if stuck anywhere you can post with screenshots if faced with an issue.

     






    -------------------------------------------
    Help fellow beings find relevant posts.
    Upvote to a supporting response.
    Mark as solution to an answer.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,662 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started