Eu atualizei este código para que ele funcione no python 3.5, obtendo duas linhas fora do loop ( wb = xlwt.Workbook()
e wb.save('output.xls')
estavam dentro do loop).
import os
import glob
import csv
import xlwt
wb = xlwt.Workbook() # put the xlwt out of the loop
for csvfile in glob.glob(os.path.join('.', '*.csv')):
fpath = csvfile.split("/", 1)
fname = fpath[1].split(".", 1)
ws = wb.add_sheet(fname[0])
with open(csvfile, 'r') as f:
reader = csv.reader(f)
for r, row in enumerate(reader):
for c, col in enumerate(row):
ws.write(r, c, col)
#Save the results once the loop is done
wb.save('output.xls')