LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel - read the formula

Solved!
Go to solution

Hello,

I'd like to open an Excel file and I need to read a particular cell where there is a formula. I mean, suppose that:

- in A3 cell there is =A1+A2;

- in A1 cell there is 1;

- in A2 there is 5

if I read A3 with the Excel Get Data.vi I recieve 6, but I'd like to read =A1+A2.

How can I do?

 

thanks,

Fabio

0 Kudos
Message 1 of 5
(2,944 Views)

@fabio.int wrote:

Hello,

I'd like to open an Excel file and I need to read a particular cell where there is a formula. I mean, suppose that:

- in A3 cell there is =A1+A2;

- in A1 cell there is 1;

- in A2 there is 5

if I read A3 with the Excel Get Data.vi I recieve 6, but I'd like to read =A1+A2.

How can I do?

 

thanks,

Fabio


At the Blockdiagram of "Excel get Data.vi", there's this (ActiveX) property node set to "value2"

In the menu of this specific property node there's also the property "formula"

 

This looks like it is possible to do what you want to achieve, but I would not want to re-write or modify the Report Generation Toolkit.

I'd start here:

http://www.ni.com/example/28409/en/

 

 

 

 

 

 

Message 2 of 5
(2,922 Views)
Solution
Accepted by topic author fabio.int

Create a subVI that takes a worksheet reference and an excel location as input, use the function Excel Get Range to return a range reference and from there, you can get the formula as output. 

Example_VI.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 5
(2,912 Views)

I'm basically reading formula from the excel sheet using vi (i have attached below/ the method u suggested). For few excel sheets values are updating, where as other sheets values aren't updating. Tired saving excel input sheet in both xls and xlsx format but didnt work. what might be the issue.

0 Kudos
Message 4 of 5
(306 Views)

Since you didn't share a spreadsheet file, it's difficult to say what is wrong without simply guessing. 

 

It looks like you have spent a lot of time reinventing the wheel, making VI's for functions that already exist.

Excel Workbook Properties - returns the numbers of sheets in the workbook

Excel Get/Set Excel Location - converts to/from cell name from a row/column pair.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 5
(255 Views)