Se você se sentir confortável com o Python, primeiro instale o módulo xlrd , que é útil para ler arquivos do Excel. Você pode fazer:
% easy_install xlrd
no terminal.
Em seguida, experimente este script básico.
#! /usr/bin/env python
import xlrd
import csv
book = xlrd.open_workbook('an_excel_file.xls')
# Assuming the fist sheet is of interest
sheet = book.sheet_by_index(0)
# Many options here to control how quotes are handled, etc.
csvWriter = csv.writer(open('a_csv_file.csv', 'w'), delimiter='|')
for i in range(sheet.nrows):
csvWriter.writerow(sheet.row_values(i))
Execute este script no diretório em que o arquivo do Excel está localizado ( an_excel_file.xls no script) chamando python xls_to_csv.py no Terminal
Existem várias opções para os objetos xlrd , bem como o módulo csv , portanto, verifique o seguinte se precisar ajustar as configurações:
- link
- Python Excel Tutorial
- Módulo CSV