LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to swap two columns in excel using labview?

Hello all..

  Is it possible to swap or cut-copy-paste a column of data in a excel file to another column of the same file using labview??

0 Kudos
Message 1 of 8
(3,895 Views)

Hi Sumithra,

 

Are you using ActiveX to control Excel? If so there are 2 ways:

 

1. Cut Data A, then paste it into temporary location. Cut Data B, then paste it into Location A. Cut Data A at the temporary location into Location B.

 

- All you need to know is how to cut and paste data set from/to your specified location. Do you know how to do it?

 

2. Read Data A and Data B into LabVIEW, overwrite Location A by Data B and overwrite Location B by Data A.

 

- All you need to know is how to Read and Write data from/to LabVIEW. 

 

Before making any assumption, please explain how you are accessing Excel using LabVIEW.

TailOfGon
Certified LabVIEW Architect 2013
0 Kudos
Message 2 of 8
(3,886 Views)

hi..

Thanks,i guess i have found the solution.By the by im using activex control.

0 Kudos
Message 3 of 8
(3,882 Views)

hai

  I got the solution by some other logic.Kindly let me know how how to cut -copy .i dont know how to do that.

0 Kudos
Message 4 of 8
(3,873 Views)

@Sumithra Nagappan wrote:

hai

  I got the solution by some other logic.Kindly let me know how how to cut -copy .i dont know how to do that.



What is your solution?

 

Show us your VI.

 

 

0 Kudos
Message 5 of 8
(3,867 Views)

swapped cols..png

 

hope this helps....

 

 

0 Kudos
Message 6 of 8
(3,852 Views)

There is 2 ways to look at this.

 

The first one is to do as TailOfGon suggested, cut and paste the column using a temporary range to rearrange their order.

 

The second one is to get the table values from Excel using the Range Value(get) property, swap the columns in LabVIEW using something similar to Apok (althought a better approach will use the in place element structure) and put back the values in Excel using the Range Value(put) property.

 

I tend to prefer the second way since it requires less activeX manipulation (only one range is used) and allow the user to perform operations on the data.

 

Ben64 

0 Kudos
Message 7 of 8
(3,819 Views)

this VI has more "user" control...Smiley Wink

 

swapped array.png

0 Kudos
Message 8 of 8
(3,789 Views)