我的程序无法处理我从 Excel 电子表格中提取的货币对象时遇到问题。除了更改货币的错误之外,代码运行并执行我想要的操作。这是我执行代码时出现的错误。有这方面的建议吗?
FutureWarning:货币对象将很快更改,因此使用了 decimal.Decimal 实例。(设置 pythoncom.future_currency现在获取这些对象。)
这是我正在运行的代码:
import sys, os, win32com.client, glob
from win32com.client import constants
xl = Excel_Document()
headerlist = ['STUDYDES','STUDYDES2','EVENTTYPE','AssessmentSOLUTIONTYPE','AssessmenFDNS-TERMINATION','SOLUTIONTYPE','FDNS-TERMINATION','GROUP','SCENARIO','ProviderOASISReservation','CustomerName','RequestedStart_Date']
ListofData = []
Data = []
counter = 1
xlslist = glob.glob('*tblFacilityLog*.xls')
for xls in xlslist:
headers = {}
sortedvalues = []
output = {}
print 'Opening Workbook: ',xls
xl.openWorkbook(xls)
sheetdata = xl.getSheetData('tblAllFacilityLog')
xl.closeWorkbook()
for row in sheetdata:
sortedvalues = []
for header in headerlist:
if header in sheetdata[0]:
output[header] = row[sheetdata[0].index(header)]
else:
output[header] = "'None'"
for header in headerlist:
sortedvalues.append(output[header])
Data.append(sortedvalues)
ListofData.append(Data)
print 'Building Workbook'
print len(Data)
print len(ListofData)
xl.addWorkbook()
xl.addWorksheet("tblFacilityLog9")
xl.selectSheet("tblFacilityLog9")
beginrow = 1
lastrow = beginrow + len(Data)
#xl.pasteData(headerlist, startcol = beginrow, startrow = beginrow, endcol = len(headerlist), endrow = 1)
for Data in ListofData:
xl.pasteData(Data, startcol = 1, startrow = 1, endcol = len(headerlist), endrow = lastrow)
xl.saveWorkbook("CombinedLog")
xl.closeWorkbook()
xl.closeApp()