Removing Duplicate Entries, Merge Data Leaving Order and Data Intact

Hello folks,

Sorry if my question has been asked, I’ve tried hard searching for the solution or tips to getting this right, but I can’t for the life of me find the right function.

I’ve got 2 .CSV files:

One has only product names, around 10,000, on column A.

The other has the same product names on column A, but about 5,000 extra names on the list, and all have matching prices on the column B.

I need to return the first .CSV file but with the added prices from the second file (or the second file without those 5,000 extra names and prices), but making sure the order and the prices are correct.

Could anybody help me here or at least point me on the right path?

For Calc:
You import both csv-files in separate sheets of one file
I hope your product nams are unique.
You can now use VLOOKUP to retrieve values from the second sheet in columns of the first sheet.
LibreOffice help on VLOOKUP

For Base:
Import both csv in tables of a database.
You can now use JOIN to combine values from both tables
Simple example from

Base can access csv directly as text-table, but to my knowledge you can not use complex joins for this type of table, so you have to import first.

Reverse approach:
In Calc you could import both files, and use COUNTIF to find out, how often a name of sheet2 is available in sheet one.
Then you can filter all rows with COUNTIF>0
and copy this to a third table as result (can be done directly with advanced filters).
Save the result back as csv, if necessary.