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

How to eliminate row from a list

I have a list with some acction already done after certain date; so in order to clean the list i want to create a flow that periodically remove the old items making a back-up in excel file.

it is possible actually manually, but I will prefere an automatic acion that can assolve this duty

regards 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: How to eliminate raw from a list

Hi @Argas,

 

Do you want to remove items whose created date is before a certain date in your SharePoint list and make a back-up in an Excel file?

Could you please show a bit more your SharePoint list?

 

I have created a SharePoint list on my side and the data structure of it as below:5.JPG

I assume that you want to remove items whose created date is 30 days old, I have made a test on my side and please take a try with the following workaround:

  • Add a Recurrence trigger, Interval set to 1 and Frequency set to Month (I assume that you want to run this flow per month).
  • Add a "Get items" action, specify Site Address and List Name.
  • Add a "Filter array" action, From set to output of the "Get items" action, within condition box, click "Edit in advanced mode", type the following formula:
@less(formatDateTime(addDays(item()?['Created'], 30), 'MM/dd/yyyy'), utcNow('MM/dd/yyyy'))
  • Add a "Apply to each" action, input parameter set to output of the "Filter array" action. Within "Apply to each" action, add a "Insert row" action of Excel connector (My Excel file is stored in my OneDrive folder), specify File name and Table name, Last Name field set to following formula:
item()?['Last_x0020_name']

First Name field set to following formula:

item()?['First_x0020_name']

Email field set to following formula:

item()?['Email']

Note: The First name, Last name and Email are columns in my SharePoint list, on your side, you should type the following formula reference the column value in your SharePoint list:

item()?['ColumnNameOfYourSPList']

If there is a space within the column name, please replace the space with '_x0020_'.

 

Add a "Delete item" action, specify Site Address and List Name, Id field set to following formula:

item()?['ID']

Image reference:6.JPG

 

7.JPG

The flow works successfully as below:8.JPG

 

9.JPG

 

10.JPG

 

 

Please also check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Using-Flows/Automatically-delete-files-in-Document-Library-after...

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

 

Best regards,

Kris

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Argas
Level: Powered On

Re: How to eliminate raw from a list

First of all thanks for the help.
In order to explain better my list o will try to explain better the project.
I have a flow already working for the management of the vacation in an office with approval and record on a common calendar.
We are using the list from one year and now the rows are becoming a lot.
So I want to reduce the number of the rows and manage the new insertions removing the old ones.
It is important to make a backup of the removing rows
So in my opinion is to create a flow that every six month can make a backup of the list and clean the rows for the item already passed leaving only two month of history.
I will try to go through the example showed above
Thanks
Regards
Arturo

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: How to eliminate raw from a list

Hi @Argas,

 

Do you want to remove items whose created date is before a certain date in your SharePoint list and make a back-up in an Excel file?

Could you please show a bit more your SharePoint list?

 

I have created a SharePoint list on my side and the data structure of it as below:5.JPG

I assume that you want to remove items whose created date is 30 days old, I have made a test on my side and please take a try with the following workaround:

  • Add a Recurrence trigger, Interval set to 1 and Frequency set to Month (I assume that you want to run this flow per month).
  • Add a "Get items" action, specify Site Address and List Name.
  • Add a "Filter array" action, From set to output of the "Get items" action, within condition box, click "Edit in advanced mode", type the following formula:
@less(formatDateTime(addDays(item()?['Created'], 30), 'MM/dd/yyyy'), utcNow('MM/dd/yyyy'))
  • Add a "Apply to each" action, input parameter set to output of the "Filter array" action. Within "Apply to each" action, add a "Insert row" action of Excel connector (My Excel file is stored in my OneDrive folder), specify File name and Table name, Last Name field set to following formula:
item()?['Last_x0020_name']

First Name field set to following formula:

item()?['First_x0020_name']

Email field set to following formula:

item()?['Email']

Note: The First name, Last name and Email are columns in my SharePoint list, on your side, you should type the following formula reference the column value in your SharePoint list:

item()?['ColumnNameOfYourSPList']

If there is a space within the column name, please replace the space with '_x0020_'.

 

Add a "Delete item" action, specify Site Address and List Name, Id field set to following formula:

item()?['ID']

Image reference:6.JPG

 

7.JPG

The flow works successfully as below:8.JPG

 

9.JPG

 

10.JPG

 

 

Please also check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Using-Flows/Automatically-delete-files-in-Document-Library-after...

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

 

Best regards,

Kris

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Argas
Level: Powered On

Re: How to eliminate raw from a list

First of all thanks for the help.
In order to explain better my list o will try to explain better the project.
I have a flow already working for the management of the vacation in an office with approval and record on a common calendar.
We are using the list from one year and now the rows are becoming a lot.
So I want to reduce the number of the rows and manage the new insertions removing the old ones.
It is important to make a backup of the removing rows
So in my opinion is to create a flow that every six month can make a backup of the list and clean the rows for the item already passed leaving only two month of history.
I will try to go through the example showed above
Thanks
Regards
Arturo

View solution in original post

Argas
Level: Powered On

Re: How to eliminate raw from a list

Thanks for the assistance.

today i have tested the flow and everithing works fine

ciao

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
Users Online
Currently online: 110 members 5,392 guests
Recent signins:
Please welcome our newest community members: