Matching invoices to payments from quickbooks for an automated statement (they share a linked id)

I have a list of invoices from a customer which I want to put on a customer statement I also have seperate payment data that links to the ‘paid invoices’ with the details of the corresponding payment. im looking to match these to datasets so they correspond in a table on a google sheet however any method I try doesn’t seem to work so unsure where to go next. cant seem to filter/iterate through them to match which seems like it should be possible with a txn id that matches.

Thanks for any help.