Created
March 5, 2014 13:06
-
-
Save araastat/9366807 to your computer and use it in GitHub Desktop.
Export each sheet of a xls/xlsx file to csv
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 pandas as pd | |
import xlrd as xd | |
def xls2csv(f, index=False, header=True): | |
wb = xd.open_workbook(f) | |
snames=[] | |
for s in wb.sheets(): | |
snames.append(s.name) | |
for s in snames: | |
x = pd.read_excel(f,s) | |
x.to_csv(''.join(s.split(' '))+'.csv', index=index, header=header) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment