I have created a webquery in excel which fetches data from the webpage in Excel file. Is there anyway i can access the same webquery in C#. I hope it makes sense. Need some valuable suggestions with the coding.
Asked
Active
Viewed 1,597 times
0
-
you want to access the excel webquery and use it in c#? why not just "rewrite" the webquery in c#? – Vogel612 May 17 '13 at 07:56
-
I don't have any idea how to initiate and rewrite it in C#. Would you please give me some idea with the coding... – waris kantroo May 17 '13 at 08:03
-
you might find something here http://www.codeproject.com/Articles/6554/How-to-use-HttpWebRequest-and-HttpWebResponse-in-N – Vogel612 May 17 '13 at 09:11
-
isn't the Excel Webquery part of the Workbook QueryTables collection? If so, you could access it from c# using Automation – Our Man in Bananas May 17 '13 at 13:20
1 Answers
0
to see how to access a web querytable through VBA in Excel, take a look at the
MSDN Library: QueryTables/Webtable documentation
this will give you the objects that you would work with in c#
for example, a Webquery is stored in a Querytable object in a worksheet in a workbook in the Excel application.
The webquery has a connection object which shows the URL, and a WebTables property determines which tables are brought in from the web page to your worksheet.
So now you just have to do some reading, and write some c# code

Our Man in Bananas
- 5,809
- 21
- 91
- 148