Sample app automating calculations in Excel



Automate Excel with Python
Excel is a handy tool when it comes to performing calculations. However, when multiple people work with Excel, often several versions of a file get created, which can become quite confusing. Which data is the latest version? Which information is correct?
How to create successful application that ensure adoption
Build successful applications

Learn the process to build apps that provide real value to your work and that other people will definitely want to use as well.

Python and Excel in VIKTOR

With VIKTOR, it is possible to create a web app with Python that integrates with any desired software, just like Excel. This web app functions as a single point of truth with a central database that always contains the latest version of a project (with version history) that all stakeholders can access.

We have written open-source code as an example of such a VIKTOR application for the automated calculation of a simply supported beam under load with Excel.

Using the functionality

There are two ways in which you can use the functionality:

  • With VIKTOR, out-of-the-box, using our free version.
  • Without VIKTOR, in that case you integrate the open-source code with your own Python code

For a full tutorial on this sample app click here.

This is a snippet of the functionality’s code from the VIKTOR GitHub repository:

1def get_evaluated_spreadsheet(self, params): 2 inputs = [ 3 SpreadsheetCalculationInput('L', params['general']['beam']['length']), 4 SpreadsheetCalculationInput('W', params['general']['beam']['width']), 5 SpreadsheetCalculationInput('H', params['general']['beam']['height']), 6 SpreadsheetCalculationInput('E', params['general']['beam']['E']), 7 SpreadsheetCalculationInput('aw', params['general']['beam']['aw']), 8 SpreadsheetCalculationInput('wa', params['general']['beam']['wa']), 9 ] 10 sheet_path = Path(__file__).parent / 'beam_calculation.xls' 11 sheet = SpreadsheetCalculation.from_path(sheet_path, inputs=inputs) 12 result = sheet.evaluate(include_filled_file=True) 13 14 return result

Here you can see it is very easy to send input to your Excel sheet. It is required to have a tab in Excel called ‘viktor-input-sheet'. To get results, you use the evaluate() method. Here, VIKTOR retrieves output from the ‘viktor-output-sheet' Excel tab.

The documentation for the SpreadsheetCalculation class can be found here

In the video, you can see how a simply supported beam under load is calculated through an integration with a spreadsheet in a VIKTOR application in the demo environment.

Apply for a demo account to get access to this and all other VIKTOR sample applications.

Calculating a beam in 3 steps

As you can see in the video, the process of automatically calculating a simply supported beam under load consists of 3 steps.

  1. Insert general information. Provide information about the beam (length, the width, height, and modulus of elasticity) and loads (starting point and distributed load amplitude).
  2. Generate results. View the maximum deflection and maximum bending stress, a schematic visualization, and a 3D visualization of the beam and loads.

schematic visualization of a beam in Excel

Schematic visualization of a simply supported beam under load.

3D visualization of a beam in Excel

3D visualization of a simply supported beam under load.

  1. Download the report. Download the calculation sheet to view on your device.

Use the free version or apply for a demo account to try the functionality yourself!

illustration of free trial

Start building apps now

Try for free

Related Blog Posts

plotly pandas numpy matplotlib python

Visualize your data with Python and VIKTOR

Read more

Save time by automating PLAXIS in the Cloud

Read more

Hackathon stimulates knowledge development

Read more

Free Trial

Start building apps now
Try for free