LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
CarstenPXI

Paste from Excel to LabVIEW Arrays

Status: New

When you have copied an row or column of the same data type from Excel, it would be cool if you could click on the desired LabVIEW array cell to paste it into LabVIEW arrays, either on the front panel or Block Diagram.  Nice to have would being able to do it for 2D arrays.

 

 

Carsten

9 Comments
GregSands
Active Participant

Yes!  Could also extend this idea to a tab-delimited (or even space-delimited) array copied from a text file.

ReneW
Member

I have added the idea to use a separate Excel-like editor. Perhaps, this would solve this problem too.

CarstenPXI
Member

The two ideas complement each other.  Even if you can edit natively in LabVIEW using Excel like methods, the need to paste from Excel would still be very nice.

 

Frin an implementation standpoint, my guess is that it would be much cheaper for NI to add the Paste from Excel function, and if that is true, it would get a large part of the problem more quickly solved.

 

Carsten Thomsen

G-Money
NI Employee (retired)

You can copy arrays and paste arrays from LabVIEW into Excel easily now (right-click on the array then choose Export and choose either Clipboard or right to Excel) but not the other way around. I like the idea and have earned my kudos Smiley Wink

Sam_Sharp
Trusted Enthusiast

Using the 'read from clipboard' invoke node (http://digital.ni.com/public.nsf/allkb/AE3293F9277FFFC98625752E007AF77C) along with http://digital.ni.com/public.nsf/allkb/38AEA2B236E43837862574400064C7A7 you should be able to import a string of data copied from Excel and convert it into a 2 dimensional array.

 

I might even wrap it up into a Sub VI as I'll be doing it tomorrow morning.


LabVIEW Champion, CLA, CLED, CTD
(blog)
X.
Trusted Enthusiast
Trusted Enthusiast

I kuddo the idea but wished that it would be generalized further than the suggestion of GregS (in other words, extend all Export options to an equivalent Import function).

For an array, Import from Clipboard/from Excel.

For a Graph, Import from Clipboard/from Excel/from Diadem (although I do not use it), etc.

Obviously, the import would fail if the source data was not of the proper format (say a 2D table imported in a 1D array, for instance).

KenB2013
Member

I was able to paste data into a string array on the front panel using an event.  The data initially goes into the first cell and the event divides up the string.  It is a simple task then to change the string to a number format if necessary.

 

Pasting to an Array.jpg 

PHacke
Member

 

Following up on Sam Sharp's method, I was interested in a 1D array of numbers copied out of a column of excel. I copied the column out of the spreadsheet and put it alone into a new spreadsheet, saved it as .csv.

Then opened the .csv in a text editor, copied the text editor's content, and ran this vi. This routine can be used in a larger vi, but I just copied the double array, moved it into my larger program and changed it to a control.

PHacke_0-1618722528057.png

not sure how to connect code but I uploaded it here

http://soundboardmaterial.pbworks.com/w/file/144020433/Column%20of%20numbers%20from%20clipboard%20to...

 

 

tst
Knight of NI Knight of NI
Knight of NI

There are links to some plugins which help with this here:

https://forums.ni.com/t5/Quick-Drop-Enthusiasts/Paste-CSV-Excel-to-Controls-Constants/m-p/4043552

 

I don't remember if any allow selecting and writing to a specific array, but it should be a reasonably easy modification if they don't.


___________________
Try to take over the world!