Using WebService API in Conjunction with EXCEL and Python

Technical Article on the Topic Structural Analysis Using Dlubal Software

  • Knowledge Base

Technical Article

Spreadsheet programs like MS EXCEL are very popular with engineers because they allow you to simply automatize your calculations and quickly output the results. Therefore, combining MS EXCEL used as a graphical interface with Dlubal's WebService API is an obvious choice. By using the free xlwings library for Python, you can control EXCEL, and read and write values. The functionality is described in the following, using an example.


The following is required for the example and for programming:

  • RFEM 6
  • Python
  • Dlubal RFEM_Python_Client
  • xlwings Python library
  • An editor for writing the program

Assuming that RFEM 6, EXCEL and Python are already installed, the next step is to install the RFEM_Python_Client libraries. We offer various learning videos and help pages describing the installation. The following links are particularly important for installation. They show the installation as well as the first steps in programming:

Program editors are also discussed in these videos. For the present example, the editor used is irrelevant. Then, xlwings must be installed, you can find corresponding information on the library website:

The complete code, for example, is located in the RFEM_pyhton_Client in the following path:

  • RFEM_Python_Client/tree/main/Examples/SteelDesign/

The file is the Python program (script) and the SteelDesignExcel.xlsm file is the associated EXCEL file.

Example for Programming

The xlwings library offers several options for combining Python and EXCEL. On the one hand, it is possible to control EXCEL out of a Python program (better known as a Python script) and also to start a Python script out of EXCEL. When starting out of EXCEL, you can either use the built-in plug-in or create a sub-routine which then starts the Python script. Details are shown here:

In our example, the Python script is started via the built-in plug-in (see image). There are two requirements. The Python script must have the same name as the EXCEL file, and it must include a main function because this function is then executed via the plug-in. Here is the first part of the main function:

# Open the excel sheet
wb = xw.Book.caller()

# Read inputs
inputSheet = wb.sheets('Inputs')

frame_number = 6
width = 10
frame_length = 4
console_height = 3
column_height = 4
gable_height = 2

# Geometric Inputs
frame_number = int(inputSheet["G6"].value)  # number of frames
width = inputSheet["G7"].value # Width of Frame
frame_length = inputSheet["G8"].value # Frame Length
console_height = inputSheet["G9"].value # Height of Console
column_height = inputSheet["G10"].value # Height of Column
gable_height = inputSheet["G11"].value # Height of Gable


If xlwings is used directly out of a Python script (not via EXCEL), a file must be opened first:

wb = xw.Book('userSheet.xlsm')


If xlwings is used out of EXCEL, the connection is established using the following command:

wb = xw.Book.caller()


The wb variable includes the complete workbook, from which individual worksheets can be extracted using the sheets() method. In the example, the "Inputs" worksheet is opened, and individual cells are accessed by means of square brackets. The value of a cell can be read out or modified by the 'value' property. This implementation can be found at the end of the example:

# Writing Results to Output Sheets
nodaldeformation["A2"].value = node_number
nodaldeformation["B2"].value = nodeSupportType
nodaldeformation["C2"].value = nodeDisp_abs
nodaldeformation["D2"].value = nodeDisp_x
nodaldeformation["E2"].value = nodeDisp_y
nodaldeformation["F2"].value = nodeDisp_z
nodaldeformation["G2"].value = nodeRotation_x
nodaldeformation["H2"].value = nodeRotation_y
nodaldeformation["I2"].value = nodeRotation_z


In the present case, load combination 7 is read out. Image 2 shows the deformations of the members in EXCEL and, for comparison, the results from RFEM 6 in Image 3.


The example shows that after setting up all necessary elements, it is rather easy to use the API. EXCEL is mainly used as a graphical user interface, and knowledge of Visual Basic for Applications (VBA) is not required. It is also possible that calculations are carried out in EXCEL (also via VBA), and Python only imports or exports data by means of xlwings.


Dipl.-Ing. Thomas Günthel

Dipl.-Ing. Thomas Günthel

Customer Support

Mr. Günthel provides technical support for our customers.


WebService Excel Python


Write Comment...

Write Comment...

  • Views 1303x
  • Updated 05/11/2023

Contact Us

Contact Dlubal

Do you have further questions or need advice? Contact us via phone, email, chat, or forum, or search the FAQ page, available 24/7.

(267) 702-2815

[email protected]

Online Training | English

RFEM 6 | Students | Introduction to Steel Design

Online Training 06/14/2023 4:00 PM - 5:00 PM CEST

Introduction to New Add-on Pushover Analysis

Introduction to the New Pushover Analysis Add-On

Webinar 06/15/2023 2:00 PM - 3:00 PM CEST

3D Modeling for Geotechnical Analysis in RFEM 6

3D Modeling for Geotechnical Analysis in RFEM 6

Webinar 06/21/2023 2:00 PM - 3:00 PM CEST

Online Training | English

Eurocode 5 | Timber Structures According to DIN EN 1995-1-1

Online Training 06/22/2023 8:30 AM - 12:30 PM CEST

Online Training | English

RFEM 6 | Dynamic Analysis and Seismic Design According to EC 8

Online Training 06/29/2023 8:30 AM - 12:30 PM CEST

New Features in Steel Joints Add-On

New Features in Steel Joints Add-On

Webinar 06/29/2023 2:00 PM - 3:00 PM CEST

AISC 360-16 Steel Connection Design in RFEM 6

AISC 360-16 Steel Connection Design in RFEM 6 (USA)

Webinar 05/24/2023 2:00 PM - 3:00 PM EST

Online Training | English

RFEM 6 | Students | Introduction to Timber Design

Online Training 05/24/2023 4:00 PM - 5:00 PM CEST

Online Training | English

RFEM 6 | Students | Introduction to Reinforced Concrete Design

Online Training 05/17/2023 4:00 PM - 5:00 PM CEST

Hall with Arched Roof

Main Program

The structural analysis program RFEM 6 is the basis of a modular software system. The main program RFEM 6 is used to define structures, materials, and loads of planar and spatial structural systems consisting of plates, walls, shells, and members. The program can also design combined structures as well as solid and contact elements.

Price of First License
4,450.00 EUR
Aluminum Cross-Section Stress

Main Program

The RSECTION stand-alone program determines the section properties for any thin-walled and massive cross-sections and performs a stress analysis.

Price of First License
1,850.00 EUR
Structural Frame and Truss Analysis Software

Main Program

The structural frame & truss analysis and design program RSTAB 9 contains a similar range of functions as the FEA software RFEM, paying special attention to frames and trusses. Therefore, it is very easy to use and for many years, it has been the best choice for the structural analysis of beam structures consisting of steel, concrete, timber, aluminum, and other materials.

Price of First License
2,850.00 EUR