使用python将csv转换为xls
我试图循环通过使用这个Python脚本的目录中的CSV文件将其转换为XLS,但到目前为止我无法实现。 会appreaciate任何帮助。 这个代码的操作说,他一次只写一个spreadhset(1个文件),但我相信它可以被一些经验的Python程序员改变。
#!/usr/local/bin/python # Tool to convert CSV files (with configurable delimiter and text wrap # character) to Excel spreadsheets. import string import sys import getopt import re import os import os.path import csv from pyExcelerator import * def usage(): """ Display the usage """ print "Usage:" + sys.argv[0] + " [OPTIONS] csvfile" print "OPTIONS:" print "--title|-t: If set, the first line is the title line" print "--lines|-ln: Split output into files of n lines or less each" print "--sep|-sc [def:,] : The character to use for field delimiter" print "--output|o : output file name/pattern" print "--help|h : print this information" sys.exit(2) def openExcelSheet(outputFileNam