Excel to pdf out of memory and no sheet selection

I use the GenericAnalysis to analyse a ‘quite large’ excel and use the convert_excel_to_pdf to download or show the pdf. Sadly I get a TimeoutError:

afbeelding

First of all, how to fix the TimeoutError, second of all, the excel is indeed quite large, so it would be great to just convert a specific sheet based on the name to a pdf.

Thank you in advance for your help!

Hi @LuukS ,

I suspect that the TimeoutError occurs because it is such a big file, and should be checked on our side whether we should increase the time.

To be able to select a certain sheet to be converted, I would guess using openpyxl to shrink the file to only that sheet could help in solving this.

You could try using openpyxl with some specific settings for being memory efficient like read_only=True, data_only=True and other options. To then get only a single sheet you can indeed use the openpyxl workbook object and get only that sheet for processing, something like:

from openpyxl import load_workbook
workbook = load_workbook(filename='large_file.xlsx', read_only=True, data_only=True, keep_links=False)
worksheet = workbook['specific_sheet']

Thank you, I got it working as I wanted!

1 Like