LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write Table to Excel

I have taken the write table to xl.vi example and modified it so that I can use it. Write now I have a vi setup that displays certain columns of data that I am pulling from a txt file in both a graph and a table. Then I am trying to write this table to xl by following the example, however I get the error 97 when running the vi, and a blank excel workbook opens up. I think this has something to do with how the table I have created is used to try and enter this into excel. Any help you can provide would be greatly appreciated. Thanks.
0 Kudos
Message 1 of 8
(4,269 Views)
Check out Document ID: 2SA65B59 in the knowledge base. Or just do a search for "error 97" under support. Looks like others have had the problem too.


Steve
0 Kudos
Message 2 of 8
(4,269 Views)
Unfortunately I don't think my problem is that simple. I get this error on the first run of my vi, and have just read the document you referenced and I have been unable to make my vi work correctly. If you have any more suggestions they would be greatly appreciated.

Thanks.
0 Kudos
Message 3 of 8
(4,269 Views)
Sorry, I hoped that some of the suggestions in the knowledgebase would help. My experience with sharing data between LV and XL is pretty limited. Are you able to use the unaltered example .vi successfully?
0 Kudos
Message 4 of 8
(4,269 Views)
Your empty Excel file is probably due to your using a local variable to populate the spreadsheet. With no dataflow, the table is probably still empty by the time Excel is trying to write the data. As far as the error, when exactly do you first get it? What version of Excel are you using. Does the unmodified shipping example work?
0 Kudos
Message 5 of 8
(4,269 Views)
Error 97 is "LabVIEW: Null Refnum was passed in as input."


You might wanna check whether the Automation Refnum is linked to the correct ActiveX class in the "Open Excel" VI.


In your diagram, as Dennis pointed out, it has no dataflow. The row header and column header in your table are both empty as well. That results in three for-loops doing nothing. Wire your "Hour" variable directly to the input of the third loop instead. Also at the end of the program, you should close all opened references regardless of the "Completion Task". Put only the invoke node "application quit" in the case structure should do.


Hope this helps.


Dan
0 Kudos
Message 6 of 8
(4,269 Views)
After one closer look, the null refnum should be caused by the empty refnum returned from first for-loop. Since row header does not exist in your table, the first loop will have zero iteration. And thus the refnum output in the first loop ends up empty.


Solution? put something in for the row header and column header in your table, or simply delete the first two for-loops. And don't forget to wire "Hour" and close refnums at the end.


Dan
0 Kudos
Message 7 of 8
(4,269 Views)
Thanks, you were right about trying to write row and column headers to my table when I had none existing. I didn't think it would make a difference, so I had left it in so that I could label my columns or rows in the future.
0 Kudos
Message 8 of 8
(4,269 Views)