LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting a spreadsheet file different ways

Solved!
Go to solution

Is there a way to have multiple formatting methods for a Write to Spreadhseet command? Like I have an array that I want to have specific columns formatted different ways.Or can you only format the whole spreadhseet file one way?

 

Thanks,

 

Konrad

0 Kudos
Message 1 of 10
(2,904 Views)

Hi Konrad,

 

when you talk about the WriteToSpreadsheetFile function: yes, you can only have one format for all elements.

 

You could create your own conversion routine easily as the CSV file format is just pure text using tabs (or comma or semicolon) as separator between the elements…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 10
(2,901 Views)

Ok thanks, is there anyway to format the individual arrays before I input them into the spreadsheet file itself?

 

Thanks,

 

Konrad

0 Kudos
Message 3 of 10
(2,886 Views)

Hi Konrad,

 

yes.

You could use any of the NumberToString formatting functions and then build the 2D array on your own using array functions.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(2,882 Views)
Format as what? You can specify the number of decimal places for numerics and you can convert each column to strings separately. The Write to Spreadsheet File does not create a native excel file as you've been told so explain what formatting option you want.
0 Kudos
Message 5 of 10
(2,881 Views)

Basically I'm trying to create a spreadsheet for value of V,I and R. I need the values for V and R to be in decimal units and I need the values for I to be in exponential format. Previously I didn't care about formatting each of these sets of data differently. I had previously just been wiring the 4155 download trace driver to a 3 element array then transposing the array. I then would write this to the write to spreadhseet function. I'm not sure what the best way is to go about formatting the individual datasets without completing reworking the code I had written before. I've attach a screen shot of what I was doing before.

0 Kudos
Message 6 of 10
(2,876 Views)

Hi Konrad,

 

please attach a real VI. Your picture shows some unrelated code in a blockdiagram that could be improved a lot from AutoCleanup…

The interesting part of saving the data is hidden in a subVI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 10
(2,869 Views)
And since it appears you have everything in subVI, you only have to change one thing. There are string conversion functions that work with a 1D array so doing an index array on the columns and then a build array on the results seems easy to me.
Message 8 of 10
(2,864 Views)
Solution
Accepted by topic author niedk

Attached is a VI which does exactly what you want. It is implemented in the simplest possible way, writing the data to disk a row at a time. If you have more than a few thousand rows, you will want to do this in a more efficient way. Let me know if you need this modification.

 

Code is in LabVIEW 2011.

Message 9 of 10
(2,827 Views)

No that code works great, thanks! I actually had sort of fixed the problem by formatting the values into a string then formatting them before building them into an array. Probably not the most efficient way of doing things but it worked.

 

Konrad

0 Kudos
Message 10 of 10
(2,784 Views)