AttributeError: 'SpreadsheetCalculation' object has no attribute 'name'

Which tool versions are you using?

SDK: v14.11.0
Platform: v24.x.x
Python: v3.12
Isolation mode: venv/docker

Current Behavior

When i try to build my spreadsheetapp, it always runs into error saying: AttributeError: ‘SpreadsheetCalculation’ object has no attribute ‘name’

Expected Behavior

This should have instead evaluated my spreadsheet.

Context (optional, but preferred)

I’m trying to input values on my excel and view results on views section.

Here is the code where I’m running into issue:

# Send inputs to the excel sheet
    def get_evaluated_spreadsheet(self, params):
        inputs = [
            SpreadsheetCalculation('project_name', params.project.pname),
            SpreadsheetCalculation('project_number', params.project.number),
            SpreadsheetCalculation('client', params.project.client),
            SpreadsheetCalculation('design_stage', params.project.design_stage),
            SpreadsheetCalculation('beam_length', params.geometryDefn.beamLength),
            SpreadsheetCalculation('bridge_deck_width', params.geometryDefn.deckWidth),
            SpreadsheetCalculation('max_construction_depth', params.geometryDefn.maxConstructionDepth),
            SpreadsheetCalculation('cantilever_allowed', params.geometryDefn.cantileverAllowed),
            SpreadsheetCalculation('max_cantilever_length', params.geometryDefn.maxCantileverLength),
            SpreadsheetCalculation('insitu_deck_slab_concrete_strength', params.deckParams.insituDeckSlab_concStrength),
            SpreadsheetCalculation('insitu_deck_slab_thickness', params.deckParams.insituDeckSlab_thickness),
            SpreadsheetCalculation('insitu_solid_slab_concrete_strength', params.deckParams.insituSolidSlab_concStrength),
            SpreadsheetCalculation('insitu_solid_slab_thickness', params.deckParams.insituSolidSlab_thickness)
        ]
        sheet_path = Path(__file__).parent / 'WSP_Net Zero_Prilim Beam Selection tool_v1.2.xlsx'
        sheet = SpreadsheetCalculation.from_path(sheet_path, inputs=inputs)
        result = sheet.evaluate(include_filled_file=True)
        return result

And this is the error:

2024-07-01 15:56:20.923 ERROR   : Exception is raised
Traceback (most recent call last):
  File "viktor_connector\\connector.pyx", line 302, in connector.Job.execute
  File "viktor\core.pyx", line 1960, in viktor.core._handle_job
  File "viktor\core.pyx", line 1945, in viktor.core._handle_job._handle_view
  File "viktor\views.pyx", line 2053, in viktor.views.View._wrapper
  File "C:\Users\UKSPC003\viktor-apps\beamSlabOptimizerApp\app.py", line 76, in get_data_view
    result = self.get_evaluated_spreadsheet(params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\UKSPC003\viktor-apps\beamSlabOptimizerApp\app.py", line 65, in get_evaluated_spreadsheet
    result = sheet.evaluate(include_filled_file=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "viktor\external\spreadsheet.pyx", line 379, in viktor.external.spreadsheet.SpreadsheetCalculation.evaluate  File "viktor\external\spreadsheet.pyx", line 414, in viktor.external.spreadsheet.SpreadsheetCalculation._create_request_body
AttributeError: 'SpreadsheetCalculation' object has no attribute 'name'

Welcome to the forum.

The inputs should be a list of SpreadsheetCalculationInput, instead of SpreadsheetCalculation.

See also the example: Tutorial - Spreadsheet Calculator | VIKTOR Documentation

1 Like

Thank you for the quick response. That fixed the issue but strangely I can’t get the correct results. Instead of correct output from excel, it is giving me [-].
Expected Results:
image

Actual Results: