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: 

Writing text string array to spreadsheet in LabView 8.0

Solved!
Go to solution

Hi,

 

I have previously used LabView 8.5 to carry out the following action, but as I am now working on a different system I am currently forced to use LabView 8.0 (Windows XP), and would ideally like to avoid upgrading to LV8.5+. However if I cannot carry out the following then i will have to!

 

I am wanting to create a spreadsheet, and am using the "Write to Spreadsheet File.vi" block within LabView. However, as I want to have column headings included, I am building an array of strings by using the "Build Array" block. This array is then fed into the "1D Data" input on the 'Write to spreadsheet' block. The format for the spreadsheet block is set by a string with "%s" going into the "Format" input. In LV8.5, the array connects fine, but in LV8.0, when I connect the output of the string array to the 1D data input, the wire becomes broken. The same happens when I use the 2D data input.

 

If I'm not doing anything wrong, how can I put headers into my spreadsheet file? Is this possible in LV8.0, or will I need to upgrade?

 

 

Thanks for the help!

0 Kudos
Message 1 of 4
(5,884 Views)

I can't recall whether or not "Write to Spreadsheet File" was polymorphic in 8.0, but it seems that it wasn't (based on your description of what you're seeing).  Maybe I am wrong, but if I'm right, here's what I'd do:

 

I'd use "Array to Spreadsheet String" (found on the strings palette) to convert your numeric data array to a spreadsheet string.  You could do the same thing with your header string as well, if you wanted.  Then I'd concatenate the resulting strings, header string first (I probably didn't have to say that, but there it is).  Then I'd use "Write to Text File" to write the whole shebang to a file.  Note that you'll have to explicitly open (or create) the file, write to it, then close it.  "Write to Spreadsheet File" does all that stuff for you already.  This way won't, so you'll have to do it yourself.

 

Maybe someone else has a better solution, but that's what I'd do.  Hope it helps!

Message 2 of 4
(5,879 Views)
Solution
Accepted by topic author thomas_p
There are also detailed instructions on the block diagram of the Write to Spreadsheet File on how to modify it to write strings. Be sure to save it with a new name and in a new location.
Message 3 of 4
(5,872 Views)
Thanks to both for the replies - I opted for Dennis' solution in the end as it was the simplest option, given I needed the use the write to spreadsheet block a number of times.
0 Kudos
Message 4 of 4
(5,843 Views)