The WEBSERVICE function returns data from a web service on the Internet or Intranet.
- The WEBSERVICE function is only available in Excel 2013 and later for Windows.
- The WEBSERVICE function may appear in the Excel for Mac function gallery, but it relies on Windows operating system features, so it will not return results on Mac.
Syntax
WEBSERVICE(url)
The WEBSERVICE function syntax has the following argument.
Argument | Description |
---|---|
url | Required. The URL of the web service to be called |
Notes:
- If arguments are unable to return the data, WEBSERVICE returns a
#VALUE!
error. - If arguments result in a string that is not valid or that contains more than the allowable cell limit of
32767
characters, WEBSERVICE returns a#VALUE!
error. - If url is a string that contains more than the
2048
characters that are allowed for aGET
request, WEBSERVICE returns a#VALUE!
error. - For protocols that aren’t supported, such as
ftp://
orfile://
, WEBSERVICE returns a#VALUE!
error.
Example
Here's an example using a fictitious webservice:
=WEBSERVICE("https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&rcnamespace=0&format=xml")
Returns:
<?xml version="1.0"?>
<api batchcomplete="">
<continue rccontinue="20221015085902|1559952690" continue="-||"/>
<query>
<recentchanges>
<rc type="edit" ns="0" title="2022 NASCAR Cup Series" pageid="64612305" revid="1116192151" old_revid="1115951681" rcid="1559952705" timestamp="2022-10-15T08:59:07Z"/>
<rc type="edit" ns="0" title="Bothrocara" pageid="5278803" revid="1116192149" old_revid="1017742971" rcid="1559952703" timestamp="2022-10-15T08:59:06Z"/>
<rc type="edit" ns="0" title="Cisnormativity" pageid="71996420" revid="1116192148" old_revid="1116189075" rcid="1559952702" timestamp="2022-10-15T08:59:05Z"/>
<rc type="edit" ns="0" title="Steppe Arena" pageid="60625799" revid="1116192147" old_revid="1116191896" rcid="1559952701" timestamp="2022-10-15T08:59:05Z"/>
<rc type="edit" ns="0" title="Marius Bülter" pageid="58074752" revid="1116192146" old_revid="1112795402" rcid="1559952700" timestamp="2022-10-15T08:59:05Z"/>
<rc type="edit" ns="0" title="Edward Eager" pageid="1633389" revid="1116192145" old_revid="1114631450" rcid="1559952699" timestamp="2022-10-15T08:59:05Z"/>
<rc type="edit" ns="0" title="Galp Energia" pageid="5969536" revid="1116192141" old_revid="1109334278" rcid="1559952696" timestamp="2022-10-15T08:59:03Z"/>
<rc type="edit" ns="0" title="Kaltungo Emirate" pageid="72011272" revid="1116192142" old_revid="1116192102" rcid="1559952694" timestamp="2022-10-15T08:59:03Z"/>
<rc type="edit" ns="0" title="List of Justice League episodes" pageid="2910641" revid="1116192139" old_revid="1116190255" rcid="1559952692" timestamp="2022-10-15T08:59:03Z"/>
<rc type="edit" ns="0" title="Joy dol" pageid="71949265" revid="1116192143" old_revid="1116192014" rcid="1559952697" timestamp="2022-10-15T08:59:02Z"/>
</recentchanges>
</query>
</api>
Tips
- For the best results, the URL for WEBSERVICE should be encoded before prior to inclusion in the formula.
- To encode a URL, use the ENCODEURL function. Then reference the cell with the encoded URL in the WEBSERVICE formula.