From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data logger to excel with timestamp

Hello all, I am currently trying to read 2 to 3 channels from a DAQ USB-6255 and record it to a spreadsheet with a timestamp. I can sucessfully record two channels but when I get the time in its column it logs the UTC in absolute seconds in the first column but will log zeros afterward. Any ideas on how to get around this? Thanks for the help. 

0 Kudos
Message 1 of 7
(1,527 Views)

Hi liconj,

 

I made a little change on your VI.

 

calopez_0-1631821933947.png

 

 

Hope it works properly now.

 

Regards,

Message 2 of 7
(1,516 Views)

Looks like that worked for logging the time, but it is still being logged as absolute time vs. relative time though. 

0 Kudos
Message 3 of 7
(1,496 Views)

maybe this would work for you

 

VI.png

0 Kudos
Message 4 of 7
(1,484 Views)

Several comments:

  • You are writing what LabVIEW calls a Delimited Spreadsheet File, a text file that Excel can open, but so can NotePad.  As the Help for the Write Delimited Spreadsheet notes, to really write an "Excel" (a .xls or .xlsx) file, you need to use ActiveX the Report Generation Toolkit, or a third-party App.
  • Your program is doing exactly what you told it to do.  You wire a TimeStamp into the r0 of the Waveform Cluster (a reasonable thing to do), and plot it.  Did you notice the appearance of the Chart on the Front Panel?  Do you see the default Time value, which shows 7 pm, 31 Dec 1903?  That's a representation (by LabVIEW) of a TimeStamp value of 0, which tells me that you are (probably) in the Eastern part of the US (or at least on EDT), as LabVIEW TimeStamps are in seconds from 1 Jan 1904, UTC (5 hours ahead of, say, New York City).  If you want to plot Relative Time, open the Properties of your Chart and change Time from Absolute Time (Date + Time on the clock) to Relative Time (from 0).
  • If you want to save Relative Time, save the Starting Time (I won't call it t0, but how about Time 0?) and save as t0 (TimeStamp - Time 0) in your Cluster.  [I hope you see that's the number of seconds between the TimeStamp you just read and the TimeStamp you saved as Time 0, i.e. "elapsed seconds"].

Bob Schor

0 Kudos
Message 5 of 7
(1,481 Views)

Thanks, I was able to convert the timestamp to days since Jan 1 1904. At that point I can just change the format in excel. Thanks again!

0 Kudos
Message 6 of 7
(1,427 Views)

I'm sure you realize that simply multiplying the Dbl you get from a LabVIEW TimeStamp and saving that in an Excel cell formatted as "Date/Time" does not get you the correct year, right?  Of course, if you are only expressing "Relative Time", then "Date" becomes largely irrelevant ...

 

Bob Schor

0 Kudos
Message 7 of 7
(1,417 Views)