cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Australia
Post Patron
Post Patron

Upload files to a website in a loop?

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.

 

8 REPLIES 8
VJR
Super User
Super User

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.

@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
Super User
Super User

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.

 

 

VJR
Super User
Super User

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.

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
Super User
Super User

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.

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
Super User
Super User

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.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Top Solution Authors
Top Kudoed Authors
Users online (3,629)