# Extract all worksheets form an excel file and export as individual CSVs
# Install xlrd with 'pip install xlrd'
# Thanks to Boud from http://stackoverflow.com/questions/10802417/how-to-save-an-excel-worksheet-as-csv-from-python-unix
import xlrd
import csv
# Open the workbook
x = xlrd.open_workbook('excel_file.xlsx')
# Iterate through each workbook.
for sheet in x.sheet_names():
worksheet = x.sheet_by_name(sheet)
# Create a file for each sheet
with open(str(sheet)+'.csv','wb') as f:
c = csv.writer(f)
for r in range(worksheet.nrows):
c.writerow(worksheet.row_values(r))