Skip to content

Instantly share code, notes, and snippets.

@ADelRosarioH
Created October 28, 2021 23:47
Show Gist options
  • Save ADelRosarioH/75a7e57efed10807e68ea6704a6576db to your computer and use it in GitHub Desktop.
Save ADelRosarioH/75a7e57efed10807e68ea6704a6576db to your computer and use it in GitHub Desktop.
combine, join or merge a list of excel (xlsx) files into a csv
import glob
import pandas as pd
workbooks = glob.glob('*.xlsx')
result_df = pd.DataFrame()
for wb in workbooks:
xlsx = pd.read_excel(wb, engine='openpyxl')
result_df = pd.concat([result_df, xlsx])
result_df.to_csv('result.csv', header=True, index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment