cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Mihnea
Level: Powered On

Download latest weekly report from share

We have weekly reports uploaded as .xlsx files to our share as week1, week2, week 29.xlxs on the same sharepoint folder. I'd like to create a flow that checks the latest file based on week number and downloads it to my pc or one drive for BIZ under a custom name "current week.xlsx" - (which I have linked to other reports via queries. )

Is there a way I can write such a flow, to search bigest week no# in the file name and download that one ? 

 

Thank you!

5 REPLIES 5
Community Support Team
Community Support Team

Re: Download latest weekly report from share

Hi @Mihnea ,

 

Do you wan to get the latest weekly report from SharePoint library then save it to other destination folder?

 

Please check if the following workaround will work for you.

 

Add a manual button trigger.

 

Initialize an Object value named as TestMax. The Value configured likes below:

 

{

  "Title": "Unknown",

  "Number": -1

}

 

 

Get files (properties only) from the library.

 

Within Apply to each, add the following actions:

 

Compose, select dynamic content File name with extension

 

Compose2:

 

first(split(outputs('Compose'),'.'))

 

 

 

Compose3:

 

substring(outputs('Compose_2'),add(indexOf(outputs('Compose_2'),'Week'),4),sub(length(outputs('Compose_2')),add(indexOf(outputs('Compose_2'),'Week'),4)))

 

 

 

Condition:

 

int(outputs('Compose_3'))

is greater than

int(variables('TestMax')['Number'])

 

 

Under If yes branch, add Set variable action, input the following Value:

 

{

  "Number": @{outputs('Compose_3')}

}

 

 

Under Apply to each, add Compose4:

variables('TestMax')['Number']

 

Add Apply to each2, select value from Get files (properties only). Within Apply to each2, add Condition to check if dynamic content File name with extension contains Compose4 output.

 

If yes, Get file content, create file in OneDrive folder.

 

Images for your reference.

 1.PNG2.PNG3.PNG

 

 

Best regards,

Mabel          

 

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Mihnea
Level: Powered On

Re: Download latest weekly report from share

Thank you, Mabel, 

I am testing this now (have an 403 denied access issue at step 3- Get file (properties only) that I am checking - not sure why it triggers as I have full access).

Will revert back. 

 

THanks,

Mihnea
Level: Powered On

Re: Download latest weekly report from share

Hi,

So I created all the steps but the flow fails at the third step even though I do have full control to the sharepoint :  

5.PNG 

 

 

Any advice ? 😞

Thank you,

Community Support Team
Community Support Team

Re: Download latest weekly report from share

Hi @Mihnea,

 

Are you able to Get items from a SharePoint list?

 

Please check the library settings, if there are any restrictions that don’t allow users to get files from the library.

 

The issue could not be reproduced on my side.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Mihnea
Level: Powered On

Re: Download latest weekly report from share

Hi Mabel,

I tried a different flow from that sharepoint library/folder and I my access is ok, Test_Weekly_KPI_access:

In the first step I enter the site address and under Folder ID : the path to my weekly folder.

Get file content: file identifier.

And it goes through when I test.

 

Weekly Flow 4.PNG

 

In my big flow, it fails with access denied.  The library contanins the folder I need. The big flow uses library. My test flow uses Folder id and it flows.  Is this difference..the difference? Should I change Get file properties only with Get file content?  Thanks

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,423)