Article ID: 274787 - View products that this article applies to.
This article was previously published under Q274787
This article explains how to create Web query files for use with Microsoft Excel for Mac.
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 includes some sample Web queries.
Definition of a Web Query FileA Web query file is a text file that contains from one to four lines of text. You can create Web query files in any text editor, such as SimpleText or TextEdit (with preferences set to text).
Note You must save query files as text files with no formatting. Rich Text Format (RTF) files are not recognized.
Web query files are saved in the following folder on your computer's hard disk:
Microsoft Office 2001:Office:Queries
Microsoft Office X/Office/Queries (in Mac OS X)
How to Create a Web Query FileTo create a Web query file, follow these steps:
How to Use Static and Dynamic Parameters in a Web QueryIn Web queries, you can use both static and 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 run.
The syntax for parameters is as follows
parameter=value stringwhere 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:
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.
Parameter type Value string ----------------------------------------------------------- Static value1 Dynamic ["value1","Please enter the first value:"]
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 demonstrate the syntax used by Web query files.
Note The following examples are not functional Web queries.
This example sends the value "wyut" to the Client.exe program and retrieves a value. You are not prompted to type any values. This example sends the parameter by using the GET method.
WEBIf you like, you can omit the first two lines and use the following line:
http://www.weylandyutani.com/cgi-bin/client.exe?quote=wyutNote It is acceptable to omit the first two lines when you create the Web query file. You can also omit these lines for all of the examples shown in this article.
This example sends the values "wyut" and "hypd" to the Client2.exe program, and then retrieves values. You are not prompted to type any values. This example sends the parameters by using the POST method.
This example prompts you to type a stock symbol, sends that symbol to the Client.exe program, and retrieves a value. This examples sends the parameters by using the GET method.
Note Type the third and fourth lines of this example on a single line in your text file.
["stock1","Please enter a stock symbol:"]
This example sends the value "wyut" and a value that you type to the Client2.exe program, and then retrieves the values. This example sends the parameters by using the POST method.
quote1=wyut"e2=["stock2","Please enter a stock symbol:"]
Contact us for more help
Connect with Answer Desk for expert help.