Python Forum

Full Version: Joining Excel data into existing Excel file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I'm coming back to Python after quite a bit of time away, and I'm facing an issue in trying to bring data from Excel file into another.

For some background, I am currently using Visual Studio Code to write my coding in, as well as two existing Excel files, each with only one sheet of data in them. One of the Excel files, A, is the master file that I'm trying to populate with data from multiple files. The second Excel file, B, contains a large amount of various data that I'm looking to import into file A. Both files, A and B, contain matching data, specifically a "Unit" column, as well as matching data columns headers that I'm trying to populate in A from B. These headers include "PM", "PT", "PD", and "Total". I'm trying to pull over data from file B into these existing columns, but only when the data in "Unit" column matches. For instance, the data will only pull from file B into file A when both have a "Bravo" in the "Unit" column.

I'm aware this is more abstract of an abstract problem as I don't have any code to share, but other than using pandas, openpyxl, and numpy, I'm stuck on how to get started. I understand that I should be importing both files, but where do I go from there? Any help in this would be greatly appreciated. Thanks so much for taking the time to read this and thanks for any help you might have.