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 / help with desktop flow
Power Automate
Answered

help with desktop flow

(0) ShareShare
ReportReport
Posted on by 125


Hello, can someone help me?
What the flow does is open an excel (excelEmail in the downloads folder) and compare the values โ€‹โ€‹of the "matri" column with the values โ€‹โ€‹of another excel (excelDDBB in the downloads folder) in the "matriDDBB" column, if the value does not exist, it creates a new one, if it exists it updates it with the value of excelEmail column "carrierEmail" in the column "carrierDDBB" of the excelDDBB file

I have the same question (0)
  • ryule Profile Picture
    929 Super User 2024 Season 1 on at

    What's the issue you are having?

  • VishnuReddy1997 Profile Picture
    2,666 Super User 2026 Season 1 on at

    Hi @antonio_piernav ,

     

    Can you Please ellabrote your issue.

     

    Regards,

    Vishnu Reddy

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    I recommend anything to do with Excel be done by VBA.  If you are sure you want to keep it in PAD, this is an AI's guess based on your brief description:

    # Define file paths
    SET excelEmailPath TO 'C:\Users\<username>\Downloads\excelEmail.xlsx'
    SET excelDDBBPath TO 'C:\Users\<username>\Downloads\excelDDBB.xlsx'

    # Launch Excel and open both workbooks
    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: %excelEmailPath% Visible: True ReadOnly: False Instance=> ExcelInstanceEmail
    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: %excelDDBBPath% Visible: True ReadOnly: False Instance=> ExcelInstanceDDBB

    # Select sheets (assuming data is in the first sheet)
    Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: %ExcelInstanceEmail% Name: 'Sheet1'
    Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: %ExcelInstanceDDBB% Name: 'Sheet1'

    # Read data from both sheets into DataTables
    Excel.ReadFromExcel.ReadAsDataTable Instance: %ExcelInstanceEmail% FirstCell: 'A1' LastCell: '' FirstRowIsHeaders: True DataTable=> EmailDataTable
    Excel.ReadFromExcel.ReadAsDataTable Instance: %ExcelInstanceDDBB% FirstCell: 'A1' LastCell: '' FirstRowIsHeaders: True DataTable=> DDBBDataTable

    # Iterate through rows of EmailDataTable
    LOOP FOREACH CurrentRow IN EmailDataTable
    # Extract "matri" and "carrierEmail" values from the current row
    SET MatriValue TO CurrentRow['matri']
    SET CarrierEmailValue TO CurrentRow['carrierEmail']

    # Check if "matri" value exists in DDBBDataTable
    Variables.FindOrReplaceInDataTable.FindItemInDataTableEverywhere DataTable: %DDBBDataTable% ValueToFind: %MatriValue% AllMatches: False MatchCase: False MatchEntireCellContents: True DataTableMatches=> FoundRows

    # If found, update the "carrierDDBB" column
    IF (Length(FoundRows) > 0) THEN
    SET RowIndex TO FoundRows[0].RowIndex
    Variables.ModifyDataTableItem DataTable: %DDBBDataTable% ColumnNameOrIndex: 'carrierDDBB' RowIndex: %RowIndex% Value: %CarrierEmailValue%
    # If not found, add a new row with the values
    ELSE
    SET NewRow TO Dictionary()
    NewRow['matriDDBB'] = %MatriValue%
    NewRow['carrierDDBB'] = %CarrierEmailValue%
    Variables.AddRowToDataTable.AppendRowToDataTable DataTable: %DDBBDataTable% RowToAdd: %NewRow%
    END
    END

    # Write the updated DDBBDataTable back to Excel
    Excel.WriteToExcel.WriteAsDataTable Instance: %ExcelInstanceDDBB% DataTable: %DDBBDataTable% StartCell: 'A1' IncludeHeaders: True

    # Save and close the Excel files
    Excel.SaveExcel.Save Instance: %ExcelInstanceEmail%
    Excel.SaveExcel.Save Instance: %ExcelInstanceDDBB%
    Excel.CloseExcel.Close Instance: %ExcelInstanceEmail%
    Excel.CloseExcel.Close Instance: %ExcelInstanceDDBB%

    Good luck!

  • antonio_piernav Profile Picture
    125 on at

    Thanks, I found the problem

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 450

#2
Haque Profile Picture

Haque 366

#3
Valantis Profile Picture

Valantis 349

Last 30 days Overall leaderboard