XL97: How to Create Web Query (.iqy) FilesLast reviewed: March 13, 1998Article ID: Q157482 |
The information in this article applies to:
SUMMARYThis article explains how to create Web query (.iqy) files for use with Microsoft Excel 97.
MORE INFORMATIONIn Microsoft Excel 97, Web queries allow you to query data from a specific World Wide Web, Internet, or intranet site and retrieve the information directly into a Microsoft Excel worksheet. Microsoft Excel 97 includes some sample Web queries. More samples are available at Microsoft's Web site at the following location:
http://www.microsoft.com/msexcel/ Definition of a Web Query FileA Web query file is a text file that contains from one to four lines of text where each line of text is separated by a carriage return. Web query files can be created in any text editor, such as Notepad, and they are saved with the .iqy extension.
Creating a Web Query FileTo create a Web query file, use the following steps:
Using Static and Dynamic Parameters in a Web QueryIn Web queries, you can use static and/or dynamic parameters. Static parameters send query data without prompting you for any values. Dynamic parameters prompt you to type one or more values when the Web query is executed. The syntax for parameters is as follows:
<parameter>=<value string>where <parameter> is the name of a parameter (for example, stock) and <value string> is a value. The value string can be one of the following values.
Parameter type Value string ----------------------------------------------------------- Static value1 Dynamic ["value1","Please enter the first value:"]In the dynamic value string, the first argument (value1) is the name of the value to be entered. The second argument is the message that appears when the Web query is executed. If multiple parameters are required, separate them with an ampersand character (&). The following example illustrates the syntax:
quote1=stock1"e2=stock2When multiple values are sent for a single parameter, separate them with a plus sign (+). The following example illustrates the syntax:
quote1=stock1+stock2"e2=stock3+stock4You can combine static and dynamic parameters within a single parameter string. The following example illustrates the syntax:
quote1=stock1"e2=["stock2","Please enter the second value:"] Examples of Web Query FilesThe following examples are designed to demonstrate the syntax used by Web query files in Microsoft Excel 97. NOTE: The following examples are not functional Web queries. Example One: This example sends the value "wyut" to the Client.exe and retrieves a value. You are not prompted to type any values. The parameter is sent using the GET method.
WEB 1 http://www.weylandyutani.com/cgi-bin/client.exe?quote=wyutIf you like, you can omit the first two lines and use the following line:
http://www.weylandyutani.com/cgi-bin/client.exe?quote=wyutIt is acceptable to omit the first two lines when you create the .iqy file. This is true for all of the examples shown in this article. Example Two: This example sends the values "wyut" and "hypd" to the Client2.exe, and then retrieves values. You are not prompted to type any values. The parameters are sent using the POST method.
WEB 1 http://www.weylandyutani.com/cgi-bin/client2.exe quote1=wyut"e2=hypdExample Three: This example prompts you to type a stock symbol, sends that symbol to the Client.exe, and retrieves a value. The parameters are sent using the GET method. NOTE: The third and fourth lines of this example should be typed on a single line in your text file.
WEB 1 http://www.weylandyutani.com/cgi-bin/client.exe?quote1= ["stock1","Please enter a stock symbol:"] Example FourThis example sends the value "wyut" and a value that you are prompted to enter to the Client2.exe, and then retrieves the values. The parameters are sent using the POST method.
WEB 1 http://www.weylandyutani.com/cgi-bin/client2.exe quote1=wyut"e2=["stock2","Please enter a stock symbol:"] REFERENCES"Microsoft Excel Web Resource Kit for Microsoft Excel 97," pages 4-6
|
Additional query words: xl98
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |