LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare Excel Workbooks in Labview

I am trying to compare two excel workbooks in labview. Both have multiple worksheets, with different values in each cell. First I would need to see that the worksheet names match.  Then I would have to check that the data in the  first column matched before I could compare the row data.  Does anyone know the best way to do this? I already have it so that it opens the two worksheets and reads in the data. I also have the report generator toolkit. If someone could help me that would be awesome.

0 Kudos
Message 1 of 12
(4,273 Views)

Hi Kristen,

 

you should do exactly as you described it:

First I would need to see that the worksheet names match.  Then I would have to check that the data in the  first column matched before I could compare the row data.

Read the worksheet names, compare them.

Read first columns, compare them.

Read rows, compare them…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(4,262 Views)

I am having problems with the reading the columns and comparing and reading the rows and comparing. Could you help me with the block diagram of this part? I am newer to Labview and don't know what to use.

0 Kudos
Message 3 of 12
(4,259 Views)

Hi Kristen,

 

what kind of problems do you have?

Where are you stuck?

Mind to attach your VI?

 

We will not do your homework, but we will be happy to pinpoint problems in your VIs and even suggest improvements or solutions!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 12
(4,257 Views)

pic.JPGBy no means is this homework. I am just trying to find an easier way to compare  221+ sheet excel workbooks. Here is what I have so far, I don't know how to compare what is in the columns. If I use the search 1D Array VI it is searching for a particular thing, not checking to see if what I have from both worksheet column is equal.

 

 

 

0 Kudos
Message 5 of 12
(4,253 Views)

Hi Kristen,

 

you attached just an image instead of a VI or snippet. Should we debug your VI using Photoshop®???

Attach your VI!

 

Before attaching your VI you should say "THINK DATAFLOW!" with loud and clear voice!

Then remove the race conditions by replacing the local variables by wires and shift registers!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(4,249 Views)

As much as I would love to fix what you told me to, I don't quite know how. Hence the reason why I came to this forum - for help. I have had no formal training in Labview and would love any help that you are willing to give. Attached is my VI. 

0 Kudos
Message 7 of 12
(4,245 Views)

Read this page, it's basically "Dataflow 101" and is one of the most important things to know about LabVIEW.  

 

Two specific things that were very easy to spot:

 

1. You have an error wire going backwards coming out of the top "Excel Get worksheet" VI

2. Both of your "Excel workbook properties" VIs feed out into a different local variable, and then in the middle those local variables are compared to each other.  Because of the Dataflow rule, it's most likely that the comparison happens first, and then the worksheet names are put into the local variables.  However, based on semi-random timing, sometimes one or the other or both will update before the comparison happens.  If you just delete both of the "Worksheet name" local variables and wire directly from the "Excel workbook properties" VIs to the "Equals" node you are guaranteed that you'll always compare the most recent variables.

 

It might help you visually if before you run the VI, you open the block diagram and turn on "Highlight Execution" (the light bulb button) at the top so you can "see" dataflow in action in slow-mo.

0 Kudos
Message 8 of 12
(4,236 Views)

I would also look into the State Machine architecture. I think this would fit perfectly for what you want to do.

0 Kudos
Message 9 of 12
(4,232 Views)

I have made some changes, would you mind looking it over and see what else I can do to improve and make it work?

0 Kudos
Message 10 of 12
(4,219 Views)