# Load data from an excel file and write data to this excel file

**URL:** <https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409>\
**Category:** MIS - Scripting Forum\
**Tags:** orthopedics, 3-matic\
**Created:** [May 17, 2021, 11:44am UTC](https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409 "2021-05-17T11:44:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ela](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Ela](https://community.materialise.com/u/Ela)\
**Post date:** [May 17, 2021, 11:44am UTC](https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409/1 "2021-05-17T11:44:01Z")

</div>

I have two problems:

first I have to load datas from an excelfile and I wrote

import trimatic  
import os  
import numpy as np  
from openpyxl import load\_workbook

def main():  
print(os.path.abspath(“D:\201110 ArbeitUlm\210411 Daten\K11\CycleExtraction\_CSV”)  
file = load\_workbook(“K11\_MC\_30\_3rdCycle.xlsx”)  
ws = file[‘Tabelle1’]

```
#print(ws['A2'].value)

p1F_coord = (ws['A2'].value, ws['B2'].value, ws['C2'].value)
p2F_coord = (ws['D2'].value, ws['E2'].value, ws['F2'].value)
p3F_coord = (ws['G2'].value, ws['H2'].value, ws['I2'].value)

print(p1F_coord)
print(p2F_coord)
print(p3F_coord)

p1F = trimatic.create_point(p1F_coord)
p2F = trimatic.create_point(p2F_coord)
p3F = trimatic.create_point(p3F_coord)

new_planeF = trimatic.create_plane_3_points(p1F,p2F,p3F)
new_planeF.name = "EbeneFemurNeu"

```

main()

and than I need to export created datas (x,y,z) in 3-matics to this excel file: How can I address the points generated? - I can’t show a screenshot at the moment because 3-matics has said goodbye. I hope you know what I mean.

> print(TKC\_duplicate.Properties.Coordinates)  
> print(TKC\_duplicate.Coordinates)  
> print(LandmarkenTibiaDuplikate.TKC\_duplicate.Properties.Coordinates)  
> print(LandmarkenTibiaDuplikate.TKC\_duplicate.Coordinates)

 ![210517 Screenshot](https://canada1.discourse-cdn.com/flex035/uploads/materialiseacademy/original/1X/2c5f03a9e86bc60651e9dccd324ade7331a1ceca.jpeg)

please help me

---

<div class="post-metadata">

**Author:** ![Marnic](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@Marnic](https://community.materialise.com/u/Marnic)\
**Post date:** [May 17, 2021, 5:00pm UTC](https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409/2 "2021-05-17T17:00:21Z")

</div>

Dear Ela Ge,

Regarding the export of coordinates in 3-matic to excel, this depend on the object. If you have a point, after assigning the point to a variable, you can get the coordinates via the “coordinates” property and you can split it in the x, y and z value by indicating which element you want to use [0] for x, [1] for y and [2] for z. An example:

![image001.png](https://canada1.discourse-cdn.com/flex035/uploads/materialiseacademy/original/1X/73fccb85fc228e5b18c9ec9e71872fad18815605.png)

These values can be directly written to a specific cell (row & column) in excel.

Your second problem is not directly clear to me, is this regarding the import of the values in excel?

Kind regards,

Marnic

---

<div class="post-metadata">

**Author:** ![Ela](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Ela](https://community.materialise.com/u/Ela)\
**Post date:** [May 17, 2021, 5:56pm UTC](https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409/3 "2021-05-17T17:56:44Z")

</div>

Thank you, I can try tomorrow, because my SW is not available now.

Yes, I need the 3 values (x, y, z) in the second row from each marker (each 3 for femur, patella and tibia) to create a new plane

 ![IMG_4870](https://canada1.discourse-cdn.com/flex035/uploads/materialiseacademy/original/1X/cf3ac28c88ff14dedd42eb49a0ac9d4f9660318b.jpeg)

---

<div class="post-metadata">

**Author:** ![Teddy](https://avatars.discourse-cdn.com/v4/letter/t/da6949/32.png) [@Teddy](https://community.materialise.com/u/Teddy)\
**Post date:** [April 5, 2024, 8:49am UTC](https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409/4 "2024-04-05T08:49:42Z")

</div>

sorry, may i know how to write to an excel file?

---

<div class="post-metadata">

**Author:** ![zack\_struczewski](https://avatars.discourse-cdn.com/v4/letter/z/b4bc9f/32.png) [@zack\_struczewski](https://community.materialise.com/u/zack_struczewski)\
**Post date:** [April 5, 2024, 3:14pm UTC](https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409/5 "2024-04-05T15:14:26Z")

</div>

Hi Teddy. Scripting in our software is done in Python. Marnic above described how to read the data from 3-Matic using the API, which activates tools or objects specific to MIS software. Writing to excel is independent of our software, and indeed can be done easily with this python module: XlsxWriter is a Python module for creating Excel XLSX files. I am sure there are other modules as well, but this is one of the more common ones I saw on Google. Hope this helps!

---

<div class="post-metadata">

**Author:** ![Teddy](https://avatars.discourse-cdn.com/v4/letter/t/da6949/32.png) [@Teddy](https://community.materialise.com/u/Teddy)\
**Post date:** [March 26, 2025, 10:27am UTC](https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409/6 "2025-03-26T10:27:22Z")

</div>

Hi thanks for the answer.  
I am doing 3D cephalometry with multiple points, lines, planes in 3-matic. Could I use the scripting to export the coordinates of all my points, lines, planes to an excel file for analysis? If yes, how should I do that?

---

<div class="post-metadata">

**Author:** ![zack\_struczewski](https://avatars.discourse-cdn.com/v4/letter/z/b4bc9f/32.png) [@zack\_struczewski](https://community.materialise.com/u/zack_struczewski)\
**Post date:** [March 26, 2025, 3:47pm UTC](https://community.materialise.com/t/load-data-from-an-excel-file-and-write-data-to-this-excel-file/409/7 "2025-03-26T15:47:50Z")

</div>

Hi Teddy, indeed this is possible and a common application. You will use the API for the ‘Export’ tools as well as the Python package Pandas to communicate with Excel. You can reach out to your local AE for assistance if needed. Let us know if you need any other help!
