ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Retrieving formulae (https://www.excelbanter.com/excel-discussion-misc-queries/49948-retrieving-formulae.html)

Rob Oldfield

Retrieving formulae
 
Hi,

I'm trying to write something in .Net which will look at an Excel file and
be able to read the formualae within it. I'd prefer not to do this via
automation and I'm currently trying it via an ADO connection. My connection
string is along the lines of

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=h:\excelsearch\1.xls;Extended
Properties="Excel 8.0;HDR=No;IMEX=1"

....but that is returning the value of a cell, instead of the underlying
formula. Does anyone know if I can change the connection string in some way
so that I get the formulae, or have any bright ideas on another way of
getting at the data?

Many thanks for any ideas.



Gary''s Student

I am not certain if this is of any value to you, but a way of getting a
formula instead of the resultant value is to put an apostropy in front of the
equals sign to convert it to text. If this can be done to the spreadsheet
cells prior to capturing them it might be a solution.
--
Gary''s Student


"Rob Oldfield" wrote:

Hi,

I'm trying to write something in .Net which will look at an Excel file and
be able to read the formualae within it. I'd prefer not to do this via
automation and I'm currently trying it via an ADO connection. My connection
string is along the lines of

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=h:\excelsearch\1.xls;Extended
Properties="Excel 8.0;HDR=No;IMEX=1"

....but that is returning the value of a cell, instead of the underlying
formula. Does anyone know if I can change the connection string in some way
so that I get the formulae, or have any bright ideas on another way of
getting at the data?

Many thanks for any ideas.




Bob Phillips

I don't think ADO will give you access to the formula, only the value. ADO
is a data access technology, and looks at all sources as a set of data.

If you want to get at the formula, you should use automation.

--
HTH

Bob Phillips

"Rob Oldfield" wrote in message
...
Hi,

I'm trying to write something in .Net which will look at an Excel file and
be able to read the formualae within it. I'd prefer not to do this via
automation and I'm currently trying it via an ADO connection. My

connection
string is along the lines of

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=h:\excelsearch\1.xls;Extended
Properties="Excel 8.0;HDR=No;IMEX=1"

...but that is returning the value of a cell, instead of the underlying
formula. Does anyone know if I can change the connection string in some

way
so that I get the formulae, or have any bright ideas on another way of
getting at the data?

Many thanks for any ideas.





Rob Oldfield

Yes, I was afraid that that would be the answer I got. Thanks anyway.


"Bob Phillips" wrote in message
...
I don't think ADO will give you access to the formula, only the value. ADO
is a data access technology, and looks at all sources as a set of data.

If you want to get at the formula, you should use automation.

--
HTH

Bob Phillips

"Rob Oldfield" wrote in message
...
Hi,

I'm trying to write something in .Net which will look at an Excel file

and
be able to read the formualae within it. I'd prefer not to do this via
automation and I'm currently trying it via an ADO connection. My

connection
string is along the lines of

Provider=Microsoft.Jet.OLEDB.4.0;Data

Source=h:\excelsearch\1.xls;Extended
Properties="Excel 8.0;HDR=No;IMEX=1"

...but that is returning the value of a cell, instead of the underlying
formula. Does anyone know if I can change the connection string in some

way
so that I get the formulae, or have any bright ideas on another way of
getting at the data?

Many thanks for any ideas.








All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com