[Python] Python program using Openpyxl & BeautifulSoup failing to convert data to Excel...

Discussão em 'Python' iniciado por Stack, Dezembro 19, 2024.

  1. Stack

    Stack Membro Participativo

    I'm writing the following script to convert data from a .XML into an excel spreadsheet, but the data is unable to be converted to Excel, or so the terminal says

    for player in data:
    if player.name != None:
    playername = player.find('firstname').string, player.find('lastname').string
    print(playername)
    sheet.cell(row=rowNum, column=1).value = playername


    terminal output output:

    File "C:\Users[censored name] \AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openpyxl\cell\cell.py", line 252, in value self._bind_value(value) File "C:\Users[censored name]\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openpyxl\cell\cell.py", line 218, in _bind_value raise ValueError("Cannot convert {0!r} to Excel".format(value)) ValueError: Cannot convert ('[censored name]', '[censored name]') to Excel

    I haven't attempted much, as I'm unsure where to even start with this, I've tried to change the playername values to no longer be a string but that didn't change anything

    Continue reading...

Compartilhe esta Página