使用该
xlrd模块阅读excel ,然后可以使用该
csv模块创建自己的csv。
在命令行中安装xlrd模块:
pip install xlrd
Python脚本:
import xlrdimport csvdef csv_from_excel(): wb = xlrd.open_workbook('excel.xlsx') sh = wb.sheet_by_name('Sheet1') your_csv_file = open('your_csv_file.csv', 'w') wr = csv.writer(your_csv_file, quoting=csv.QUOTE_ALL) for rownum in range(sh.nrows): wr.writerow(sh.row_values(rownum)) your_csv_file.close()# runs the csv_from_excel function:csv_from_excel()


