Excel render_spreadsheet error

Hi,

I am trying to run an excel macro file. The code below returns the error "expected <class ‘int’> for the render_spreadsheet function.

Do you have an idea where this comes from?

Thanks for your help,

MĂ©lissa

    @DataView("Excel", duration_guess=2)
    def run_excel(self,params,**kwargs): 

        #input def
        input_cells = [
            # DirectInputCell('sheet1', 'E', 9, params.tab_1.section_0.configuration)
        ]
        
        #macros def 
        macros = [Macro('CalcEp')]
        area_cell = DirectOutputCell('sheet1', 'E', 46)
        direct_output_cells = [
            area_cell
        ]

        template_path = Path(__file__).parent / 'check.xlsm'

         #fill spreadsheet with values/text
        with open(template_path, 'rb') as f:
            template_as_bytes = BytesIO(f.read())
            filled_spreadsheet = render_spreadsheet(template_as_bytes, input_cells)
      
        #input excel arguments
        excel = Excel(template=filled_spreadsheet, named_input_cells=input_cells,
                    macros=macros, direct_output_cells=direct_output_cells)

  
        excel.execute(timeout=120)
    
        return DataResult(area_cell.result)
    

Is that a typo or did you deliberately leave a # in front of the DirectInputCell in your snippet?

It’s not a typo, I was checking that the problem was not coming from this line.

Hi Melissa, would it be possible to DM me the spreadsheet and input values you are using?

Hello, I have the same error but from this thread I cannot find a solution. What could be wrong with an excel template with this specific error in general? Is it more likely something in the definition of the input_cells of does it have to do with the excel (.xlsx / .xlsm) template itself?

Cheers, Boudewijn