Difference between revisions of "Merge Excel Spreadsheet with same columns"

From rbachwiki
Jump to navigation Jump to search
(Created page with "=Merge two spreadsheets= '''Merge two or more spreets from different files with similar columns, but choose which columns you want to include in the merge''' <pre> import pan...")
(No difference)

Revision as of 16:25, 1 September 2020

Merge two spreadsheets

Merge two or more spreets from different files with similar columns, but choose which columns you want to include in the merge

import pandas as pd
file1 = 'wall1.xlsx'
file2 = 'wall2.xlsx'

wall1 = pd.read_excel(file1)
wall2 = pd.read_excel(file2)

values1 = wall1[['SKU','ProductType','SA3']]
values2 = wall2[['SKU','ProductType','SA3']]

dataframes = [values1, values2]
join = pd.concat(dataframes)
join.to_excel("output.xlsx")

Back To Top - Category