LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I copy data from a Labview table or plot and paste it into a text or Excel file?

Why doesn't the LabVIEW forum here at the ni.com website have subthreads? It would make browsing the forum for related information easier. Anyway, I have 2 questions:

My first question is, how can I copy data from a LabVIEW table and paste it directly to a text file as delimited text, or paste it straight into an Excel spreadsheet? Working through an intermediate file is not an option because our customer says "it adds an extra step that complicates things and opens a door for operator error". Currently, when I right click a LabVIEW table/plot I can select "copy data". But when I paste this "data" into another application (like Wordpad, Excel, etc), it pastes it as a bitmap image, and not as tab delimited data. This is unacceptable because data depicted in a bitmap image is not a retrievable format where the data can be retrieved, edited and plotted using a program of our choosing (e.g. Matlab, OpenOffice, Excel, etc.) The MySQL database frontend project I'm working in is becoming more and more like an Excel clone written in Labview. I'm hitting some stumbling blocks though because LabVIEW tables are limited compared to Excel tables.

My second question is related to my first question. Is there any way I can use LabVIEW to edit the contents of the operating system's copy/paste clipboard? If so, I could write Labview code to format the text on the clipboard. That way the data could be pasted nicely into either Excel or a plain text file.

Thanks,
Richard
0 Kudos
Message 1 of 15
(14,701 Views)

@Richard Ballantyne wrote:
Why doesn't the LabVIEW forum here at the ni.com website have subthreads? It would make browsing the forum for related information easier. Anyway, I have 2 questions:

My first question is, how can I copy data from a LabVIEW table and paste it directly to a text file as delimited text, or paste it straight into an Excel spreadsheet? Working through an intermediate file is not an option because our customer says "it adds an extra step that complicates things and opens a door for operator error". Currently, when I right click a LabVIEW table/plot I can select "copy data". But when I paste this "data" into another application (like Wordpad, Excel, etc), it pastes it as a bitmap image, and not as tab delimited data. This is unacceptable because data depicted in a bitmap image is not a retrievable format where the data can be retrieved, edited and plotted using a program of our choosing (e.g. Matlab, OpenOffice, Excel, etc.) The MySQL database frontend project I'm working in is becoming more and more like an Excel clone written in Labview. I'm hitting some stumbling blocks though because LabVIEW tables are limited compared to Excel tables.

My second question is related to my first question. Is there any way I can use LabVIEW to edit the contents of the operating system's copy/paste clipboard? If so, I could write Labview code to format the text on the clipboard. That way the data could be pasted nicely into either Excel or a plain text file.

Thanks,
Richard




Hi Richard,
I answered to this already in another forum, but now understand better what you do..
When I couldn't reproduce the reported behaviour in my first answer, it was because I had selected elements from the table and Ctrl-C/Ctrl-V 'd them to Excel. When I right pop-up on a table or graph control to copy them, then indeed the bitmap is copied.

In your case you could copy programmtically via the clipboard. There is a VI which does that and I attach it here:

But via the clipboard is really not the best way to go, and I would suggest to try some ActiveX access to excel from labview (or even go via an intermediate file to transfer date). I'm not an expert with activeX and excel, though, so you need to find information on that somewhere else in this or other forums.

Your final remark, that your MySQL frontend more and more looks like an excel clone makes we wonder why you do not write the whole application in excel (which is probably doable). So, is there a labview specific feature that you really depend on?
0 Kudos
Message 2 of 15
(14,676 Views)
Here is a vi that takes data from a table and puts it directly into excel. No copy paste. If you need more help in this area please let me know I have a bunch of vi's that interact with excel.



Joe.
"NOTHING IS EVER EASY"
Message 3 of 15
(14,657 Views)
When I use Control-C and Control-V to copy/paste from a LabVIEW 7.1.1 table into Excel, Notepad or whatever, it only pastes the contents of the selection's upper left cell.
0 Kudos
Message 4 of 15
(14,639 Views)
Thank you everyone for your feedback. I'm really suprised at the quality of the responses I've gotten here and also on the LAVA forums. I appreciate it.

I would prefer to use the ActiveX solution as a last resort since that would require that I write ActiveX controls for every application that the user might want to "Paste" the data into. The ideal solution would just be for NI to rename "Copy Data" as "Copy Data as Image" and add a new menu item called "Copy Data as Text" to both the popup menu that appears when you right click on your table selection and plots. For 2D plots, data could just be pasted as plain text in tab delimited columns. All tab delimited text data pastes very nicely into any text editor, Excel, and OpenOffice.

Also, whether or not ActiveX even works for Excel or other programs requires that the developer (Microsoft in this case) do not change their variable names in upcoming software versions. As some people have probably already figured out, the "Set Cell Value.vi" in Write_Table_and_Chart_to_XL.llb does not work with Microsoft Excel XP because Microsoft renamed "Value" from Excel 2000 to "Value2" in Excel XP. I managed to get "Set Cell Value.vi" to working by changing "Value" to "Value2" in the "Range" propery node. But now "Set Cell Value.vi" only works with Excel XP and not previous versions of Excel. Adding in version detection/handling is just more work, and still doesn't guarantee compatability with newer versions of Excel. Hence my reluctance to go the ActiveX route.

Richard
0 Kudos
Message 5 of 15
(14,636 Views)
Thank you fahlers for clipboard.llb. This should do the trick nicely! 😄
0 Kudos
Message 6 of 15
(14,634 Views)

Hello

Can you help me with a probelm with Excel. I need to copy data values from an excel sheet ( from row 4 column 1 to row 9 column 4) and paste these data diretcly to  WSord document. How is this possible? Do you have a vi for this?

Thanks

0 Kudos
Message 7 of 15
(14,064 Views)
Hello
I am having an error with the following vi . Can anyone help in correcting this error.
Thanks
0 Kudos
Message 8 of 15
(14,043 Views)

Hello Matthew,

All I had to do to get your VI to work was change the range "Value" property to "Value2".

Also, please don't post on old threads.  This thread is almost 2 years old and you have a much lower chance of someone finding your post if you reply to threads this old.

Regards,
Justin D

Message Edited by Justin D on 02-16-2007 10:05 AM

0 Kudos
Message 9 of 15
(14,025 Views)

Hello

Can anyone help me in copying the contents of a cell in Excel and paste to the a wrod document. With the VI in the above message i was able to get the contents in a cell in excel , but as a table. When i directly connect the output from array to spreadsheet string to a specific position in word it does not work. Can any one help?[ I have attached the vi for it below]

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 10 of 15
(13,990 Views)