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 / Comparing 2 lists (txt...
Power Automate
Answered

Comparing 2 lists (txt files)

(0) ShareShare
ReportReport
Posted on by 206

Hi Everyone,

I am trying to compare 2 text files.

The 1st list is a txt file that i created and the second one is a list from a PDF file. I have extracted the text from the PDF and save the text in a txt file.

 

For the 2 files, i choose these options :

- Store content as : List (each is a list Item)

- Encoding : UTF-8

 

For the PDF to txt :

Encoding : UTF - 8

 

Here is a part of the value from the PDF.

 

XRQ57_1-1629971113338.png

and the values from the other list

XRQ57_3-1629971277371.png

 

 

The result of finding common list item is blank.

Of course, i tried to compare the first list with itself and it works. Same result for the second list.

 

I even took the value from the pdf file and copy/past to my first list, but the result is the same, blank.

 

Thanks for your help

 

 

 

 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    MichaelAnnis_0-1629989645206.png

     

    This logic should work for comparing 1 list to another.  In this example, only list 1 is being looked for in list 2 and all the unmatched items are being added to a 3rd list.  You could essentially repeat this logic and have list 2 look for matches in list 1 in order to get it done both ways.

    I am a firm believer in VBA, and you could probably do this much faster in VBA by writing both lists to Excel and running a Macro, but this PAD solution will work.

     

    Best of luck!

  • John_Mavridis Profile Picture
    Microsoft Employee on at

    Hello,

    There is a dedicated action that compares one list versus the other for common items, 'Find common list items'.

     

    @XRQ57 Have you checked for any whitespaces hidden at the beginning and/or end of the value "SUEZ RV NORD EST"? For instance, if this item in the first list has no such whitespaces, but the item in the second list does, then they are basically considered different values.

     

    'Trim text' is a handy action for that purpose, should you need it.

  • XRQ57 Profile Picture
    206 on at

    Hi,

    thanks for the answer.

    I used 'Trim text", but it does not work.

    I made few tests :

     

    List 1 and 2 have the same unique value => it works

    List 1 have 2 values and list 2 only one value => not working

    When i use Trim text, items are stocked like this

     

    Without 'Trim text", values are stocked like this

    XRQ57_1-1630046495830.pngXRQ57_2-1630046513312.png

     

    With 'Trim text'

    The fileContents are the same but not the list. The comma is missing

    XRQ57_3-1630046638758.png

    I don't understand what is wrong

     

  • Verified answer
    XRQ57 Profile Picture
    206 on at

    I found the solution.

    No need to create a list because items are still in a list when reading the txt file. (Store content as : List (each is a list Item).

    So i compare "%fileContents% 😉

     

  • John_Mavridis Profile Picture
    Microsoft Employee on at

    Glad to know you made it work!

     

    Regarding the 'Trim text' action, I was referring to apply that to each list item in both lists (as in iterate through the lists and update their items accordingly), before comparing the lists versus each other.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 355

#2
11manish Profile Picture

11manish 336 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard