Showing results for 
Search instead for 
Did you mean: 

Export .csv with measure unit

Hi Community,

I would like export channel groups directly in .csv file mantain at least the measure unit:

Raw1    Channel Name (base property)

Raw2    Unit (base property)

Raw3-n Data (numeric)

I have tried with DataFileSave but export only channel name and data.

Due to a long channel and not standard channel I can't use write in csv info x info. 

Ii it possible use a dataplugin also for saving?

What's the short way to export csv with base properties? 

0 Kudos
Message 1 of 3

Hello Arrow90,


to export data from DIAdem to a text/CSV file you can write a python script. Python comes with a unit that can be used to create a CSV file very easily and with just a few lines of code.


The following small script writes a CSV file in which all channels of the first group are separated by the tab separator and stored with the channel name and the unit.


import csv

export_names = []
export_units = []
min_chn_len = 0

with open(dd.CurrentScriptPath + "ExampleExport.csv", "w", newline="") as file:
    writer = csv.writer(file, delimiter="\t")
    for chn in dd.Data.Root.ChannelGroups(1).Channels:
        if min_chn_len == 0 or chn.Size < min_chn_len:
            min_chn_len = chn.Size
    chn_values = []
    for chn in dd.Data.Root.ChannelGroups(1).Channels:
        chn_values.append(chn.GetValuesBlock(1, min_chn_len))
    # Transpose matrix for CSV writer.
    chn_values = [[chn_values[j][i] for j in range(len(chn_values))] for i in range(len(chn_values[0]))]



If you want to reload the CSV file in DIAdem later, you will need to create a CSV DataPlugin for it, as the standard CSV reader does not support the unit. To create the DataPlugin, you can use the Text-DataPlugin Wizard.

0 Kudos
Message 2 of 3

Hello AnJalpaka,

I have all codes in VBS and if is possible I prefer a solution in VBS.

If I haven't other ways, I will try to use your Python code.


Thank you for your support

0 Kudos
Message 3 of 3