LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing Row range from labview to excel

Dear all,

 

My application needs to read some columns of excel sheet row by row (Eg. Columns A to D) then process on it and write output in specific columns of that row (Eg. E to H). I could able to read & process the data but facing the problem in writing out put data back to column range of same row. To more elaborate the problem, Suppose my Column A is having some values and column B is having some values. I want to read these columns row by row and write addition of these number in column C of respective row. 

 

Can anybody help on this. I can write to excel but finding difficulty in writing to specific column of  same row.

 

Thanks & Regards,

Gajanan

0 Kudos
Message 1 of 10
(3,452 Views)

How are you trying to achieve this?

Are you using Report Generation Tool Kit?

All you have to do is select the Cell Range1 and Cell Range2

----------------------------------------------------------------------------------------------------------------
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 2 of 10
(3,447 Views)

Thanks for your reply.

No. I have never used report generation tool kit. I just stuck at this step. It will be of great help if you can provide steps to do this.

0 Kudos
Message 3 of 10
(3,439 Views)

The question is also do you have access to the Report Generation Toolkit? The RGT is included if you have the professional version of LabVIEW, it is an add-on (that you have to pay for) for other versions.

 

If you don't have the RGT you will have to do it using ActiveX. You can do an "Excel ActiveX" forum search and you will find plenty of exemples to get you started.

 

Ben64

0 Kudos
Message 4 of 10
(3,400 Views)

@gaju0083 wrote:

My application needs to read some columns of excel sheet row by row (Eg. Columns A to D) then process on it and write output in specific columns of that row (Eg. E to H). I could able to read & process the data but facing the problem in writing out put data back to column range of same row. To more elaborate the problem, Suppose my Column A is having some values and column B is having some values. I want to read these columns row by row and write addition of these number in column C of respective row. 

 


There is a lot that is "unspecified" in the above description, some of which would be helped by your attaching an already-existing Excel Workbook and explaining, with reference to the data found there, what you want to accomplish.  Note that you give two "examples" above, one reading columns A-D and writing columns E-H, the other reading A and B and writing C = A+B.

 

You talk about doing things "row by row".  If all of the data already exist, doesn't it make sense to read "Column A" (an Array), "Column B" (another Array), and write Column C = A + B (a third Array)?  Why do it "row by row"?

 

Why are you using LabVIEW to do this?  What does LabVIEW have to do with Excel?  Have you ever thought about simply opening the Excel Workbook and putting a Formula in Column C that equates the cell with A+B?

 

I echo the earlier responders who ask for more information about your LabVIEW system, specifically if you have the Report Generation Toolkit and the Excel functions.  You can tell by opening the Block Diagram Palette, seeing if there is a Report Generation sub-Palette, and seeing if there is an "Excel Specific" entry under that.

 

Bob Schor

0 Kudos
Message 5 of 10
(3,394 Views)

Thanks for replies. 

 

I do not have Report generation tool kit. I have to find some other way around.

 

Answering to your questions Bob, I have an excel sheet with inputs and expected outputs in rows for test cases. I am sending inputs Row by row to test system and taking the actual output. Now I want to write this actual output against each respective row, compare the Expected output with Actul output and the write result to column next to it. This will be one iteration. It will repeat for all rows. Thus column to compare I am getting at runtime.

0 Kudos
Message 6 of 10
(3,374 Views)

You may save your Excel file to *csv(Comma Separated Value) then read that file.

Using general array functions you can get the values of any column & then write to same file.

 

Please Note: *.xls or *.xlsx file has multiple worksheets But *.csv has only one sheet.

Please reply with KUDO if it works for you.

Regards

Love Diwan

0 Kudos
Message 7 of 10
(3,368 Views)

Thanks everybody.

 

With your help, I could able to write specific range as required. But now I am facing another problem. I am using Report generation tool kit. Please find attached image. I am running this code in loop to iterate through excel rows.  Now I could able to write the data in front of respective row in each iteration but when I move to next iteration, previously written data get vanished and finally in excel sheet I get data written only for last row. 

 

How I can save the data at each iteration? What I am doing wrong here?

 

Another problem is, at each iteration code is giving attached error. How Can I avoid this error?

Download All
0 Kudos
Message 8 of 10
(3,365 Views)

Please do not attach images!  If you were looking for help with a Matlab or C++ program, would you attach an image of a listing?  I cannot "test" an image, cannot "modify" an image, cannot get "help" on a function I don't recognize in an image (admittedly, I recognize most of them), etc.

 

If your function only involves a few (up to 3) VIs, attach them all.  If it involves many, compress the folder that contains them (you are using LabVIEW Project, aren't you?) and attach the resulting Zip file.

 

Bob Schor

 

P.S. -- I'm confused by something.  When originally asked if you had the RGT, you said "No, I'll have to find some other way".  Here, you say "Yes".  Have you searched the LabVIEW Forums to find (good) example code showing how to use the RGT and Excel?  Try typing the word "Revised " (with the space at the end) in the Search bar and see what pops up ...

 

P.P.S -- attach VIs!!

0 Kudos
Message 9 of 10
(3,355 Views)

You have many problems.  Your first error does not come from the code shown since the file name is different and the VI referenced is not shown. The second error would caused by your using the New Report inside your loop. You started by saying the file contained test parameters. Why are creating a New Report?  If the file specified is your parameters file,  you need to open it instead.  Please move this function to before the loop is run. You can save your changes inside the loop and close the file outside the loop. 

Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 10 of 10
(3,329 Views)