LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to enter numeric values into excel sheet and how to select a particular element from excel sheet?

How to write data into Excel sheet and if I want to enter a new data it should not replace the old data rather it should be at the top row and older data pushed down the row?

Also how to select a particular element of that Excel sheet and display it on the front panel?

0 Kudos
Message 1 of 27
(3,382 Views)

To program Excel you have two options:

  • Buy the Report Generation Toolkit.
  • Program it yourself using ActiveX. There is an example that ships with LabVIEW that can get you started. You will need to know the ActiveX object model of Excel This is documented over at Microsoft. You can find lots of examples in this forum. Search. You can also find a user-made toolkit, as well as links to other examples in the Excel thread. NOTE: DO NOT POST QUESTIONS IN THE EXCEL THREAD!!!!
0 Kudos
Message 2 of 27
(3,371 Views)

Reading from Excel worksheet is fairly straigthtforwrd. The included examples with LabVIEW show you how.

 

Generally people keep appending new data.

I would suggest that instead of pre-pending new data as you want to do.

 

 

0 Kudos
Message 3 of 27
(3,365 Views)

Mostly pre-pending the data to any file directly is not possible (as far I know) what you have to do in that case is you need to read the entire data and keep it in memory and insert the data at the top and the write the whole data again to the same file overwriting the old content. This will be valid for files of smaller size if the file size grows bigger you may need to chunk the data and take only the portion where you want insert the data.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 27
(3,362 Views)

Of course, you could also take the easy approach, and simply deal with text files. Then you don't have to worry about ActiveX. Just use the Write to Spreadsheet File VI. It can create a delimited text file that you can import into Excel.

0 Kudos
Message 5 of 27
(3,361 Views)

Yes, but that won't help him with his wanting to pre-pend data.

 

 

0 Kudos
Message 6 of 27
(3,356 Views)

Using ActiveX you can use the Insert method of the Range object to insert a row type range you defined at row 1 of the worksheet. The method has a shift argument that you can set to xlShiftDown (-4121) to push the other rows down.

 

Ben64

Message 7 of 27
(3,355 Views)

@nyc_(is_out_of_here) wrote:

Yes, but that won't help him with his wanting to pre-pend data.


Why not? Read the file. Prepend your string. Write out the new string to the file.

0 Kudos
Message 8 of 27
(3,346 Views)

@smercurio_fc wrote:

@nyc_(is_out_of_here) wrote:

Yes, but that won't help him with his wanting to pre-pend data.


Why not? Read the file. Prepend your string. Write out the new string to the file.


I know that, but I was referring to his unspoken expectation that he can just write data and have it automatically be pre-pended.

 

0 Kudos
Message 9 of 27
(3,342 Views)

Ah, well, sometimes we can't cure someone's expectations on how the universe works (without checking first) vs how it actually does.

0 Kudos
Message 10 of 27
(3,338 Views)