LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Searching a specific value from an excel file(.csv or xls) using labview without activeX

Hi everyone, 

I am quite new to labview. I was wondering if there is any way to search a specific value in an excel file using labview. For instance, 

name age

x         10

if I have a file containing the above information, I want to search for x and get 10 in return.

I would upload a picture or the code, but I am still in the designing my code phase so I dont have either. I was thinking about the potential possible ways to do this without using activeX. 

 

Thanks for the help,

Kaawn

0 Kudos
Message 1 of 13
(2,638 Views)

Two suggestions:

  1. Use a database (MySQL, MSSQL Express, etc) instead of Excel but you will still be relying on ActiveX.  Is there a reason you want to avoid ActiveX?
  2. Store this data as a CSV file, not an XLS file.  At a minimum, you can read the values into an array and search for the entry you need.  There are other methods that may be more efficient, depending on the number of entries in your dataset. 

 

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 2 of 13
(2,601 Views)

There are several Third-Party-Toolkits available on the Toolsnetwork, that can read or write excel files (xlsx and partially xls) without relying on the ActiveX methods provided by a installed Excel program.

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 3 of 13
(2,599 Views)

Hi Aputman,

There is no specific reason behind not using activeX. I am just trying to figure out if there is any other way around it. Also does activeX work with all the versions of labview. I am using labview 8.0. I am quite new to labview, so if labview 8.0 does support activex, would you guide me on how to make that work for my problem?

 

Thanks,

Kaawn

0 Kudos
Message 4 of 13
(2,591 Views)

Hi Jens,

Is there any specific one that you could recommend?

 

Thanks,

Kaawn

0 Kudos
Message 5 of 13
(2,590 Views)

I recommend XLR8 

 

Frankly I have had several issues over the years using ActiveX. There is no way to be certain any one PC will have all the ActiveX components (for lack of a better word) and that they will be compatible with your code.

 

I have had several ActiveX automated Excel methods fail on target machines (INCLUDING NI's own examples) and worked with NI on the issue. In the end NI basically threw up their hands and said some ActiveX thing or another was incompatible.

 

So I avoid using ActiveX in general

========================
=== Engineer Ambiguously ===
========================
Message 6 of 13
(2,581 Views)

Hi RTSLVU,

I was looking for something that would not cost money. Yeah it is probably faster and easier, but I was wondering if I could use anything from what labview already has like the read from a spreadsheet or something like that to read a specific value from an excel file.

 

Thanks,

Kaawn

0 Kudos
Message 7 of 13
(2,575 Views)

Well if you save your Excel file as a .CSV you can use the "Read Delimited Spreadsheet" vi to read it.

 

Actual Excel (.XLSX) files are a compressed XML format that can't be directly read. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 13
(2,572 Views)

Hi RTSLVU,

Yeah, that is what I am trying to do but I cannot get any specific value out of it. I can either get the entire data or the first column, but how do I search for a specific value in a given row and column?

Thanks,

Kaawn

0 Kudos
Message 9 of 13
(2,567 Views)

@kaawn wrote:

Hi RTSLVU,

Yeah, that is what I am trying to do but I cannot get any specific value out of it. I can either get the entire data or the first column, but how do I search for a specific value in a given row and column?

Thanks,

Kaawn


As I said in my post above, import the CSV into an array and you can search values there.  

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 10 of 13
(2,564 Views)