LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert strings to excel with order

Hi, new to LabVIEW, friend recommended the LabVIEW community.

Try to put my values into excel while each values can go to each column in xlsx. I already tried to use 'Write to spreadsheet file' but didn't manage to do it. It requires 1 or 2D array however my data are multiple strings like 1.3432, 3.4232, 4.2323, 3.3434...... Anyone can help?

 Thanks in regards

 

0 Kudos
Message 1 of 20
(2,208 Views)

Hi AIEXINUK,

 

It requires 1 or 2D array however my data are multiple strings like 1.3432, 3.4232, 4.2323, 3.3434.

So you have "multiple strings", but you don't have them in a 1D array? Why not?

 

Anyone can help?

Sure - after you attach some VI to depict your problem.

What is the input datatype? (With example data…)

Which result do you expect? (With example data…)

Best regards,
GerdW


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

Hi GerdW,

 

Wow that's a quick reply.

The reason for there is no 1D array data is that the configuration function icon in the instrument drive already defined the output pattern which I talked before. Sorry for currently I am unable to post the VI but here is the result that I am expected.

Capture.PNG

0 Kudos
Message 3 of 20
(2,197 Views)

Hi AIEXINUK,

 

as easy as this:

check.png

 

The reason for there is no 1D array data is that the configuration function icon in the instrument drive already defined the output pattern which I talked before.

You really should show your VI when writing sentences like that…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 20
(2,192 Views)

Hi GerdW,

Thank you for your help, MY friend says best way to say thanks is giving a KUDO so, here it is.

I know it right, but for now I don't have that desktop with the VI we are talking about so sorry for that.

And this won't work because the output from the machine is dynamic and can not be connecting with this function, while it shows the error: the type of the source is string and the type of the sink is 2D array. 

 

0 Kudos
Message 5 of 20
(2,183 Views)

Hi AIEXINUK,

 

so waiting for your VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 20
(2,179 Views)

@AlEXINUK wrote:

Try to put my values into excel while each values can go to each column in xlsx.


There are two ways to organize data in a "spreadsheet" that can be read by the Microsoft program "Excel".  One uses the proprietary Microsoft Excel File specification, and has the extension ".xlsx".  This type of file can hold data in several formats (strings, Booleans, integer or float numerics, TimeStamps, etc.), can have Cells with different formatting (color, Font specifications), and can include objects such as graphs.

 

The other "spreadsheet" format is a plain text file that uses only string data, with "rows" appearing as lines of text (i.e. terminated by an "end-of-line" character(s)) and "columns" separated by a designated "separator", often a Comma.  Such a file type is knows as a Comma-Separated Values (".csv") file.  Microsoft Excel can also open such a file and present it to you as an "Excel Spreadsheet" (and, indeed, Microsoft uses an "Excel-lookalike" Icon for this file type, just to confuse you).

 

LabVIEW treats these two forms of "Spreadsheets" differently.  CSV (the plain text) files can be read and written using the "Read/Write Delimited Spreadsheet" functions on the File I/O Palette.  You should note, however, that the LabVIEW default Column Separator is a <tab>, not a <comma>.  You should also note that since the data are written as text, numeric Float data may lose precision (for example, 1/3 will probably be saved as 0.333, which is smaller than 1/3).

 

If you want to read/write Excel files as .xlsx, you can use the Report Generation Toolkit (if it is installed in your LabVIEW version).  This actually opens Excel and passes data to it, getting it to do the formatting and I/O.  It is a little more complicated to use, and might not be required for your application.

 

Bob Schor

Message 7 of 20
(2,156 Views)

Thanks for your detailed information.

I just searched Report Generation Toolkit which charges hundred pound even thousand... So I think I will just stay with the spreadsheet..

As you mentioned, "spreadsheet" function allows users to choose which type of data they want to input. And in my program, I choose string as the type but this function requires 1 or 2D array of string. Meanwhile, my output are just string.

Unfortunately I am unable to provide VI to you for now, that would be much easier for us if I could at the moment. Any suggestions?

 

ALEX

0 Kudos
Message 8 of 20
(2,146 Views)

Hi AIEXINUK,

 

that would be much easier for us if I could at the moment.

Yes!

 

Any suggestions?

Why is your "output" just a scalar string?

How do you want to place a scalar string in a spreadsheet (aka 2D array of strings)?

Why can't you create a 2D array of strings in your VI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 20
(2,144 Views)

Hi GerdW,

Apologise for the inconvenience again.

Again, because the hardware is a DMM while the DMM has the different functions to measure the type of measurements. Which means each function requires a VISA and they should be in series. This is why the output is in scalar string.( I think?)

I don't have the skills to change how it was programmed (i am still a newbie) so I assume that I can change or add something after the output.

Like I mentioned, the dynamic outputs are simply like: 234134,2334535,131321,3453536......(value and comma and value and comma and value......), so the way I want in the excel is that every value is in a new column with a header.

Appreciate it.

0 Kudos
Message 10 of 20
(2,140 Views)