LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fix headers to top of excel file

Hey Everyone,

 

I am trying to write a program on LABView that records every temperature point on an excel spreadsheet every five seconds. However, I am trying to fix a header to the top of the file (which describes what each reading is). So far, I have managed to get the header to show up, but it keeps repeating. In addition, there is a space between all my recordings. This is more of an inconvenience than anything, but I would love it if someone could help me out in finding a fix for this too!

I have attached the relevant VIs - the excel program is in the case loop at the bottom. 

0 Kudos
Message 1 of 8
(2,447 Views)

I have also attached a sample excel readout

0 Kudos
Message 2 of 8
(2,445 Views)

@tompkins92 wrote:

...that records every temperature point on an excel spreadsheet every five seconds. 


I don't see anything in your core that relates to excel. What a birds nest of wires!

0 Kudos
Message 3 of 8
(2,441 Views)

Yes, I am trying to clean up my code a little. Apologies :). The main code relating to excel is at the bottom of the while loop, In the case structure.

0 Kudos
Message 4 of 8
(2,438 Views)

I haven't looked at your code but check out the following post that deals with writing to excel.  See if it helps any.

 

http://forums.ni.com/t5/LabVIEW/I-want-to-write-2D-array-to-specific-colums-rows-in-excel/td-p/25046...

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 8
(2,433 Views)

@aputman wrote:

I haven't looked at your code but check out the following post that deals with writing to excel.


He's writing to a plain delimited text file.

0 Kudos
Message 6 of 8
(2,428 Views)

You are writing your headers everytime you write your data.

 

You only need to write them once at the start outside your loop.

 

see attached...

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 8
(2,414 Views)

If you save your VI for 2009 I can open it and take a closer look.

 

As for the header, just write it to the file outside of any loops and before any of the results are recorded. 

 

Assuming you append to the same file, it doesn't matter if you write the header right before the loop or 6 years before the loop ever takes place.

 

Example:

 

                     [-----------------------------------------]

                     [                                         ]

                     [                                         ]

[write header] --->  [          loop and record data           ]

                     [            every 5 seconds              ]

                     [                                         ]

                     [                                         ]

                     [-----------------------------------------]

 

 

As for the blank lines, you are likely writing empty strings with only a new line character to the file.  This could be a result of writing faster than results are being computed, or you are wiring invalid strings to the Write to Spreadsheet File VI.  Make sure that there will be a valid string before writing the results to file.  If this is happeningin parallel, use some form of synchronization.

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 8 of 8
(2,413 Views)