Created
August 7, 2019 18:08
-
-
Save cmpadden/f73ba9cdc5bf9e9eb8d46d96db25beb2 to your computer and use it in GitHub Desktop.
Convert CSVs into Excel Worksheet Tabs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Convert CSVs into Excel sheets | |
| """ | |
| import glob | |
| import pandas as pd | |
| with pd.ExcelWriter("output.xlsx") as writer: | |
| for file in glob.glob("*.csv"): | |
| df = pd.read_csv(file) | |
| df.to_excel(writer, sheet_name=file.replace(".csv", ""), index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment