Excel working inconsistently

Which tool versions are you using?

SDK: v13.0.0
Platform: v2022.08.5
Python: v3.7
Isolation mode: venv

Current Behavior

I am sending some data to Excel using SpreadsheetTemplate.
Sometimes it works and the results are sent, and sometimes when opening Excel, the cells are empty.
I havent changed anything between tries and the same data is being used/sent each time.
I have used a print statement to make sure that the InputCells have the data in.

Expected Behavior

I would expect that the code would work consistently and fill the data in excel every time.

Hi Natalie,

We would like to solve this problem. Are you able to share a (small) code snippet, so we are able to recreate the problem on our side.

thanks, Maarten

Hi Maarten
Sorry for the delay in responding, I was on holiday.

Including a snippet that makes sense is somewhat hard to do.
The code basically reads in results from 3 json files, manipulates them and then sends them to a excel template.
the code below is the sending to excel.
cells = … is where it manipulates the data and does all the InputCellRange etc.

    cells = temp_excel_input(model)
    excel_path = Path(__file__).parent / "plaxis_results.xlsx"

    ATTEMPTS = 5
    for attempt in range(ATTEMPTS):
            excel_result = SpreadsheetTemplate.from_path(excel_path, input_cells=cells).render()
        except InternalError:

    if attempt == ATTEMPTS - 1:
        raise UserException("Spreadsheet template kon niet gevuld worden (back-end issue)")

    zip_output = BytesIO()
    with zipfile.ZipFile(zip_output, "w") as output_file:
        output_file.writestr("xxxxxx.xlsx", excel_result.file_content)

    timestamp = get_timestamp()
    project = model.project_info.project_name
    onderdeel = model.project_info.part_name
    filename = f'xxxx{project} {onderdeel} {str(timestamp)}.zip'

    download_result = DownloadResult(file_content=zip_output.getvalue(), file_name=filename)
    return ViktorResult(download_result=download_result)