0
I am developing a utility to transform XLS and XLSX files to CSV, but I would like CSV files to come out with semicolon separator instead of comma, here is the code:
# -*- coding: iso-8859-1 -*-
import glob
import pandas as pd
excel_files = glob.glob('D:\Conversao de Dados\Central de
Utilitarios\PROJETOS\XLS2CSV\excel\*.xlsx') # caminho dos arquivos excel
for excel in excel_files:
out = excel.split('.')[0]+'.csv'
df = pd.read_excel(excel) # converte apenas 1 folha por arquivo
df.to_csv(out)
Much of the code is not my own and I am not experienced in Python, if anyone can help me, I would be very grateful...
Please see the documentation of
pandas.DataFrame.to_csv
– Woss
a simple way to do this is to write at the beginning of the Sep file=;
– Lucas Miranda
being the ; the type of separator that you want, can be anything else example: Sep=|
– Lucas Miranda
Got it personal, thanks for the help... just put the Sep = ';' after the out on the last line df.to_csv(out, Sep=';')
– Renan