Professional Documents
Culture Documents
def main(argv=sys.argv):
try:
excel = ExcelDocument()
for xls_file in glob.glob('*.xls'):
full_path = os.path.abspath(xls_file)
new_path = os.path.abspath(xls_file[:-4] + ".csv")
excel.open(xls_file)
excel.save_as(new_path, fileFormatCSV, True)
excel.close()
excel.quit()
except pythoncom.com_error, (hr, msg, exc, arg):
if exc is None:
print "There is no extended error information"
else:
wcode, source, text, helpFile, helpId, scode = exc
print "The source of the error is", source
print "The error message is", text
print "More info can be found in %s (id=%d)" % (helpFile, helpId)
return 1
else:
return 0
if __name__ == "__main__":
sys.exit(main())