How do you match a imported CSV with Exchange API

I’ve imported a wallet using a CSV, but I don’t know how to match those imports to the Exchange API. I have duplicates. Should I not import the wallet transactions that correlate to the exchange and manually update the exchange transactions to point to the imported wallet? If I don’t do this I get duplicate transactions.