溢出错误:Python int太大,无法使用openpyxl转换为C long。加载\u工作簿(文件名,keep\u vba=True)

2024-09-28 21:56:52 发布

您现在位置:Python中文网/ 问答频道 /正文

for clid in ClientID:
        filename = path_xlsx.replace('/', '\\') + '\\' + str(ClientID[clid])
        # print(filename)
        
        for i in range(len(csv)):
            if str(csv.loc[i, 'ClientID']) == clid:
                
                book = openpyxl.load_workbook(filename, keep_vba=True)

我有以下错误:

enter image description here

Excel名称(文件名为:12149.xlsm)

另一个相同的excel,但内部进行了一些修改,只有这一个不想打开

enter image description here

例如,仅使用此代码:

import openpyxl
global book

filename='C:/Users/victor/12149.xlsm'
book = openpyxl.load_workbook(filename, keep_vba=True)

我也有同样的错误: enter image description here

def from_excel(value, offset=CALENDAR_WINDOWS_1900):
    if value is None:
        return
    if 1 < value < 60 and offset == CALENDAR_WINDOWS_1900:
        value += 1
    parts = list(jd2gcal(MJD_0, value + offset - MJD_0))
    _, fraction = divmod(value, 1)
    jumped = (parts[-1] == 0 and fraction > 0)
    diff = datetime.timedelta(days=fraction)

    if 0 < abs(value) < 1:
        return days_to_time(diff)
    if not jumped:
        return datetime.datetime(*parts[:3]) + diff
    else:
        return datetime.datetime(*parts[:3] + [0])

Tags: infordatetimereturnifvaluedifffilename