Export DIAdem Data Portal to Excel with Script

Updated Jun 5, 2018

Reported In

Software

  • DIAdem

Issue Details

I would like to export my data portal from DIAdem to an Excel file. How can I do it with a script?

Solution

To do the task described above you can use the following script:
Option Explicit

Call DataFileSave(CsvParameters("C:\temp\out_ger.csv", "ger"), "CSV")
Call DataFileSave(CsvParameters("C:\temp\out_eng.csv", "eng"), "CSV")

function CsvParameters(byval filePath, byVal lang)
  select case lang
    case "ger"
      CsvParameters = "<filename>" & replace(filePath, "&", "&amp;") _
      & "</filename><decimalpoint>,</decimalpoint><delimiter>;</delimiter><timeformat>DD.MM.YYYY hh:mm:ss</timeformat>"
    case "eng"
      CsvParameters = "<filename>" & replace(filePath, "&", "&amp;") _
      & "</filename><decimalpoint>.</decimalpoint><delimiter>,</delimiter><timeformat>MM/DD/YYYY hh:mm:ss pp</timeformat>"
    case else
      CsvParameters = filePath
  end select
end function

The script above will save all the data from the Data Portal into a .csv file.

To use this script:

  1. Open DIAdem SCRIPT panel
  2. Copy and paste the code to the SCRIPT editor
  3. Run the SCRIPT
  4. Two files will be created to the folder specified
Excel may use a comma or a dot as a decimal separator based on your Windows Regional Settings, thus use the "eng" or the "ger" version of the file created to make Excel read the .csv correctly.

Additional Information

An other way to export the Data Portal is to use the Excell Export Wizard. In the DATA device window, select File»Save As and select Excel format in the "Save as Type" pull-down menu. This will launch the Excel Export Wizard, where you can customize the data and channel information to be exported.
You can also use the TDM Excel Add-In to
load and work with TDM and TDMS files in Excel.
However if you need more flexibility during the export you can customize the script on a deeper level.

WAS THIS ARTICLE HELPFUL?

Not Helpful