ValueError:无法将[-0.2、29.0、0.0、0.0、33.38]转换为Excel Python 3 Openpyxl

问题描述

好的,所以我正在与Pandas和Openpyxl一起尝试读取现有的excel文件获取一些行,以便将这些行添加到另一个excel文件中的数据库中,问题是尝试时出现错误从两个文件附加数据。有什么建议?非常感谢您的宝贵时间。

# directorioOrigen = contains the path of the file from origin
# directorioDestino = contains the path of the file of destination (Excel database)
# entryTags = a list of Strings that represents the header names of columns the user needs to    # obtain from the origin file
def ProceSararchivo(directorioOrigen,directorioDestino,entryTags):
    listaTags = entryTags.get()
    archivo = pd.read_excel(directorioOrigen,skiprows=9,index_col='Timestamp')
    listaTags = listaTags.split(',')

    for i in range(len(listaTags)):
        listaTags[i] = listaTags[i].strip()

    dataCruda = archivo[listaTags]

    dataCruda = dataCruda.values.tolist()

    destino = op.load_workbook(directorioDestino)
    sheet = destino.get_sheet_by_name('Data cruda')

    sheet.append(dataCruda)
    destino.save(directorioDestino)

    MensajeExito()

我得到的错误

    raise ValueError("Cannot convert {0!r} to Excel".format(value))
ValueError: Cannot convert [-0.2,29.0,0.0,33.38] to Excel

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)