Monday, March 12, 2012

Possible to send parameter to Excel (via Web) to pas along through to SQL Server?

Is there anyway to pass a parameter to an Excel spreadsheet (loaded in a browser) to use as a parameter in SQL statement?

I know that the Microsoft Technologies can write Excel files and then load them, but I'm looking to take an existing workbook, parameterize the SQL statement and pass parameters via the Querystring/Form Post to it.

Why you may ask? For existing PivotTables/Charts that can be filtered BEFORE they are run.

Any/all thoughts appreciated.

BobYeah, there's a lot you can do. Check out this KB article for some ideas and code:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;316934|||What I'm looking to do specifically is to have a "template" of a workbook that I will pass connection/SQL Query information to, to be displayed on the fly.

Example:
A Pivot Table show results of: SELECT * FROM Products WHERE ProductID = <parameter
Web page passes a ProductID and the query is run (with the filter).

I'm assuming that I will have some sort of VBA code to hold the CORE query and I would like to be able to pass the parameter via ASP.

Any additional thoughts?

Thanx,
Bob|||Ok, I think I understand what you're trying to do. I believe this article shows you how (see the Generate XML from a Dataset for use in Excel 2003 section):

http://msdn.microsoft.com/office/understanding/excel/technicalarticles/default.aspx?pull=/library/en-us/odc_xl2003_ta/html/odc_xltransferxmltoxlwvb.asp

No comments:

Post a Comment