Created
July 15, 2021 12:39
-
-
Save iraklidd/1d17aa351608eb69118888aed2260269 to your computer and use it in GitHub Desktop.
save excel sheets as csv files, using python (jupyter notebook)
This file contains 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
import os | |
import pandas as pd | |
from datetime import date | |
f_name = 'Samle Data.xlsx' # Enter excel file name (from the same directory) | |
prfx = os.path.splitext(f_name)[0] # you can change prefix | |
sffx = datetime.today().strftime('%Y-%m-%d') # or suffix | |
WS = pd.ExcelFile(f_name) | |
for i in range(len(WS.sheet_names)): | |
df = pd.read_excel(f_name, sheet_name=WS.sheet_names[i], dtype=str) | |
df.to_csv(prfx + '_' + WS.sheet_names[i] + '_' + sffx + '.csv', sep=',', header=True, index=False, encoding='utf-8') | |
WS.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment