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!