# Data export from command line or python API

**URL:** https://forum.qoitech.com/t/data-export-from-command-line-or-python-api/504
**Category:** Automation Toolbox
**Created:** [September 2, 2024, 2:38pm UTC](https://forum.qoitech.com/t/data-export-from-command-line-or-python-api/504 "2024-09-02T14:38:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pontus.fuchs](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@pontus.fuchs](https://forum.qoitech.com/u/pontus.fuchs)
#### Post date: [September 2, 2024, 2:38pm UTC](https://forum.qoitech.com/t/data-export-from-command-line-or-python-api/504/1 "2024-09-02T14:38:58Z")

</div>

Hi,

I’m using the otii3 + automation license to measure power in an automated test setup. Is it possible to extract data in CSV or other format from command line or python API?

Pontus

---

<div class="post-metadata">

### Author: ![bjorn.rosqvist](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.qoitech.com/bjorn.rosqvist/32/238_2.png) [@bjorn.rosqvist](https://forum.qoitech.com/u/bjorn.rosqvist)
#### Post date: [September 3, 2024, 6:28am UTC](https://forum.qoitech.com/t/data-export-from-command-line-or-python-api/504/2 "2024-09-03T06:28:18Z")

</div>

Hi Pontus and welcome to the forum,

We do not have any specific APIs for exporting to CSV but let me help you generate it yourself by using the APIs for reading the data from the channels.

Something like:

Get the data from each channel wanted by:  
`mc_samples = your_recording.get_channel_data_count(device_id, "mc")`  
`mc_data = your_recording.get_channel_data(device_id, "mc", 0, mc_samples)`  
You can find the channels here  
[https://www.qoitech.com/help/tcpserver/arc.html#arc-enable-channel](https://www.qoitech.com/help/tcpserver/arc.html#arc-enable-channel)

Check the time starting time for the first samply by  
`mc_data["timestamp"]`  
Check the time in-between each sample with  
`mc_data["interval"]`  
Iterate through all items in  
`mc_data["values"]`  
and get the measurement

Generate a csv file with the data above.

I hope this helps!

Best regards,  
Björn

---

<div class="post-metadata">

### Author: ![pontus.fuchs](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@pontus.fuchs](https://forum.qoitech.com/u/pontus.fuchs)
#### Post date: [September 3, 2024, 7:35am UTC](https://forum.qoitech.com/t/data-export-from-command-line-or-python-api/504/3 "2024-09-03T07:35:24Z")

</div>

Many thanks for that Björn. Works perfectly!
