Showing results for 
Search instead for 
Did you mean: 

Convert/Import TDMS to Excel

Go to solution

So I have some LabVIEW code which logs to TDMS just fine.  I installed the TDMS Excel Add on to Excell 2007 and it imports the TDMS just fine and it looks good.


What I would like do do now is instead of just having that TDMS file, I would also like to have the XLS equivalent as well.  As if I imported the TDMS in Excel, and then went to save the workbook as XLS or XLSX.  So I wanted to programatically import the TDMS file, get the active workbook from Excel, and then programatically save the active workbook as XLS, or XLSX in the same directory as the original TDMS.


I'm having problems with the first step of my plan.  I see here there are some details about how to call the TDMS import using ActiveX but when I use it I get an error.  Calling  ShowAboutDlg or ShowConfigDlg work just fine, but when I call the Import it I get a "An unknown error occured: 0x80004003" which I believe is a invalid pointer.


Attached is the VI I was using to try to import a TDMS file.  Saved in 8.20, running TDM Importer, with Excel 2007, on XP SP3. Thanks.


EDIT: The VI is pointing to a TDMS file which comes with LabVIEW 2009, this path may need to be changed.

Message Edited by Hooovahh on 03-11-2010 09:08 AM
0 Kudos
Message 1 of 57

Hi Hooovahh,



From the TDM Excel Add-In name, you can see it can't live without Excel:)


So you need create Excel._Application first before you using ExcelTDM Automation.

You can use the following G code to import TDMS file.


Using Excel AddIn in LabVIEW

Message 2 of 57
Accepted by topic author Hooovahh

Thanks alot ykdoubles, your VI was very helpful.  With it was able to accomplish my goal of being able to convert from TDMS to .XLSX using Excel and the add on.  Here is what I came up with for anyone that's interested.


If you have Excel 2003 it may not work, or you may just need to update some of the calls.

Message 3 of 57

I tried your TDMS to Excel VI but it seems that a subVI is missing and caused errors in my LabView, 8.6 version.


A dialog box come up asking for "Strip path", any idea what it is?

0 Kudos
Message 4 of 57
You need to install OpenG toolkit. It's free on internet.
Message 5 of 57



i have installed the "OpenG toolkit"on my pc,,but the problem (asking for "Strip path", )is still there,

the install package only contain labview6.X and labview 7.0,,

any idea what it is?


0 Kudos
Message 6 of 57



I'm guessing from the name that you are just stripping a portion of the file path from the original one, so that you don't overwrite the TDMS file.  This VI doesn't seem to effect the overall functionality of the program; I'd try replacing it with the Strip Path VI found on the File I/O palette. 


Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 7 of 57

Yeah sorry forgot that I used that OpenG VI, attached is another version which doesn't use it for those of you not on the OpenG bandwagon.

I've been using this VI for a little while now and it's worked great on several machines.  But recently I've started to see problems where I get an error 97, LabVIEW:  Null Refnum was passed in as input.

This happens for me coming out of the property node ITDMAddin.  I probed the reference going in and its value is 0, with the variant data also of value 0.  Any ideas on how this could happen or what can be done. 


I changed the COMAddIn propety node from Object to Description and the string is "National Instruments TDM Importer for MS Excel" So that makes me believe that I am getting the reference to the AddIn but for some reason the Object property returns a value of 0.


EDIT: Okay I think I figured it out, if Open New Instance is TRUE for the Open Automation it works fine. Not sure why but it fixes it, a new version with the fix is up.

Message Edited by Hooovahh on 06-01-2010 05:36 PM
Message 8 of 57

really cool, thanks for sharing this!

We have two ears and one mouth so that we can listen twice as much as we speak.


Antoine Chalons

0 Kudos
Message 9 of 57

Just a note that this could be updated to use the latest TDMS for Excel add on.  If you haven't tried it yet, with the latest (not sure what version it started) version of the add on it associates the file extension .TDMS.  So all you need to do is perform a system exec on the TDMS file and it will launch Excel and perform an import for you.  Then all that's needed is calls to Excel to perform a save on the new work book.

Message 10 of 57