LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot test data present in multiple excel worksheets

I have an xls file(attached) having date, time, test status, & test execution time present on multiple worksheets.

How can I plot XY graph of datetime vs test status  , datetime vs test execution time?

 

 

0 Kudos
Message 1 of 7
(2,860 Views)

There are a number of examples showing how to use the Report Generation Toolkit (which I don't know if you have, as you've provided no information on your LabVIEW version, LabVIEW expertise, LabVIEW code, etc.) to get data from Excel files.  Once you have the data in LabVIEW, I assume you know how to plot in LabVIEW.

 

Bob Schor

0 Kudos
Message 2 of 7
(2,830 Views)

Hi Bob

Thanks for your reply.

 

I am new to Labview and using Labview 17 eval version. If Report generation toolkit can solve this problem, can you please provide me the Labview code for plotting this excel data.

0 Kudos
Message 3 of 7
(2,787 Views)

There are two things to consider:  Getting the data from Excel using the RGT, and making plots from what you get.  The code below does the first part, and gives you a 3-D Array with the first index representing the index of the Excel Worksheet (I'm showing Index 1, or Sheet 2), and the other two indices being the rows and columns of the Worksheet.  I did everything as Strings, and left the header row intact (you can tell Excel Get Data to start reading from Row 1, if you want to skip the header).  I'll leave it to you to parse rows and columns in order to construct the (LabVIEW) plots you want to make.

Get Excel Data.pngExcel Data.png

The first function, New Report, opens your existing Workbook.  The second function, Excel Get Workbook Properties, returns the number of Worksheets.  The For Loop uses Excel Get Worksheet and Excel Get Data to get the Worksheet contents as a 2D array of Strings, and the final function, Dispose Report, closes Excel.

 

Bob Schor 

0 Kudos
Message 4 of 7
(2,781 Views)

Thanks Bob for your reply.

 

I have to plot date-time vs Test Status & date-time vs Test Execution Time,

on combined data of all the worksheets.

 

The solution suggested by you, allows me to plot on per worksheet basis.

 

Can you please suggest a solution where I can read the combined data from all the worksheets, and then finally plot the graphs.

0 Kudos
Message 5 of 7
(2,760 Views)

Bob Schor's Reply Clearly states that the attached snippet will read the data (String datatype)from all sheets with header, all you need to do is use array function and extract data in the way you expect and plot in the graph as you wish.

 

Hope he needs you to come up with solution, so that he left with reading the data and not plotting the same.

 

Try to look into example's of graph/arrays to complete this activity.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 6 of 7
(2,751 Views)

@depme wrote:

The solution suggested by you, allows me to plot on per worksheet basis.

 

Can you please suggest a solution where I can read the combined data from all the worksheets, and then finally plot the graphs.


If you actually run my code (or even just look at it and think what it does, especially look at the Excel Data 3-D array returned), you will see that this returns All Sheets (first dimension), All Rows (second dimension), and All Columns (third dimension).  You have all the data.  You know what it is you want to plot.  Assemble the data from Sheets, Rows, and Columns and plot them!

 

I gave you this example as I assumed you needed a little help with the RGT, but you knew enough LabVIEW to be able to handle arrays and the construction of graphs/plots.  If this latter assumption is wrong, go back to the LabVIEW Basics on Arrays, For Loops, and Graphs.  Also check out the Examples that ship with LabVIEW.  Also, "play Scientist" and experiment -- write a few tiny VIs where you generate some known data and try to plot it, making many mistakes until you figure it out.

 

Bob Schor

0 Kudos
Message 7 of 7
(2,746 Views)