web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Problem with Add a row...
Power Automate
Suggested Answer

Problem with Add a row to Excel when specific columns change on a SharePoint list

(0) ShareShare
ReportReport
Posted on by
I am trying to add a row to Excel (stored on SharePoint) when any one of three columns (Stage, Status, Estimated Cost) change in a SharePoint list. 
I am having issues with setting the Add a row into a table to add the old value for any/all of the 3 columns and then the new value.
 
For the Since, I did the current version minus 1 - 
sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
 
 
I would like to update the Excel table to have old and new value columns that match each of the SP list columns in the condition (Stage, Status, Estimated Cost)
 
Any advice on how to add the old value and new value to an Excel table if any/all 3 columns (Stage, Status, Estimated Cost) of a SharePoint list is updated?
Categories:
I have the same question (0)
  • Suggested answer
    Ravi-Prajapati Profile Picture
    416 Moderator on at

    You can accomplish this in Power Automate by using the "When an item is modified" trigger in SharePoint and then retrieving both the current version and the previous version of the list item. Here’s how you can do it step by step:


    Steps to Capture Old and New Values and Add Them to Excel

    1. Trigger: Use "When an item is modified" (SharePoint).
    2. Get previous version: Use the "Get changes for an item or file (properties only)" action.
      • Set Since to:
        sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
      • This will retrieve the previous version of the item.
    3. Check if specific columns have changed:
      Use the condition block to check if Stage, Status, or Estimated Cost has changed by looking at the output of "Get changes for an item or file".
    4. Get previous values:
      • If any column has changed, use the "Get Item" action with VersionNumber -1 to fetch the old values.
    5. Insert into Excel:
      • Use "Add a row into a table" (Excel connector).
      • Map old values (from "Get Item" for the previous version).
      • Map new values (from the trigger output).

    Example of How to Structure the Flow

    1. Trigger: "When an item is modified"

    2. Action: "Get changes for an item or file (properties only)"

      • Site Address: Your SharePoint Site
      • List Name: Your SharePoint List
      • ID: Trigger Output - ID
      • Since:
        sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
    3. Condition Block: Check if Stage, Status, or Estimated Cost changed:

      • Has Column Changed: Stage is equal to true
      • OR
      • Has Column Changed: Status is equal to true
      • OR
      • Has Column Changed: Estimated Cost is equal to true
    4. If True:

      • Action: "Get Item" (to retrieve old values)
        • Set the ID to the trigger output's ID
        • Retrieve properties from VersionNumber - 1
      • Action: "Add a row into a table" (Excel)
        • Map:
          • Old Stage: Get Item → Stage
          • New Stage: Trigger Output → Stage
          • Old Status: Get Item → Status
          • New Status: Trigger Output → Status
          • Old Estimated Cost: Get Item → Estimated Cost
          • New Estimated Cost: Trigger Output → Estimated Cost
          • Modified Date: Trigger Output → Modified Date

    Notes:

    • The Get changes for an item action will return true if a column has changed, so you only trigger the Excel update when needed.
    • The Get Item action ensures you retrieve the previous values correctly.
    • If multiple columns change, all old and new values will be logged in Excel.
    • Ensure the Excel table has columns for Old Stage, New Stage, Old Status, New Status, Old Estimated Cost, and New Estimated Cost.
  • Kapil775 Profile Picture
    28 on at

     I was able to add the old and new values of the modified columns to excel by following below youtube video.
     

    https://www.youtube.com/watch?v=Ek4oYWPWfT0&t=1188s
     

    After getting old values using 'Send an HTTP request to SharePoint' connector, I used an Apply to each loop to iterate for each changed column. Then I used a Switch and added conditions for each excel column as in the snapshot below. Then the excel was updated using 'Add a row into a table' activity.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 976

#2
Valantis Profile Picture

Valantis 863

#3
Haque Profile Picture

Haque 547

Last 30 days Overall leaderboard