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

Most recent file in one drive or email

Im looking for a way to take the most recent  excel file in one drive and convert the worksheet to tables. Im having a hard time finding a way to choose the most recent file as the selections I see want to point to a specific file. 

1 REPLY 1
Community Support Team
Community Support Team

Re: Most recent file in one drive or email

Hi @jchauvet,

 

Do you want to get the most recent file in OneDrive and then convert it to a table?

I have figured out a way to get the most recent file in OneDrive, please check the following flow for a reference.

Add a button trigger.

Add OneDrive connector List files in folder.

Initialize variable, set Name as Max, Type as Array.

Add Apply to each, inside the Apply to each add the action Append to array variable. Set Name as Max, and set Value with the following code:

ticks(items('Apply_to_each')?['LastModified'])

Under the Apply to each, add a Compose action with the following code to get the Max value:

max(variables('Max'))

Add Apply to each 2, select output Value from the action List files in folder.

Within the Apply to each, add a Condition with the following code to get the Max one:

@equals(ticks(items('Apply_to_each_2')?['LastModified']), outputs('Compose'))

Under if yes branch, add a Compose to return the file name.

Screenshot for your reference.

1.PNG

To convert the worksheet to Excel table, we will have to use the Excel Online action Create table. However, dynamic content in File&Table inputs are not supported in Excel Online connector. So I am afraid that we could not achieve creating a table in this scenario.

There is a similar request on supporting dynamic content in File&Table inputs for connector Excel Online, please feel free to vote the idea at here:

https://powerusers.microsoft.com/t5/Flow-Ideas/Dynamic-content-in-File-amp-Table-inputs-Excel-Busine...

 

 

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.

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

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 Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,292)