Practice free

WEBSERVICE function

WEBSERVICE calls a web address and returns the raw response text, often fed into FILTERXML. It works on Windows only and does not send custom headers or keys, so many APIs will not work.

Example

=WEBSERVICE("https://example.com/data.xml")

Expected result: n/a Not yet checked in desktop Excel

Syntax

WEBSERVICE(url)

url (required)
Web address to request, up to 2048 characters.

Returns: The text the web service returns.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=WEBSERVICE("file:///C:/Windows/win.ini") #VALUE! Non-http scheme (file:)
=WEBSERVICE("abc") #VALUE! Not a URL
=WEBSERVICE("") #VALUE! Empty string
=WEBSERVICE(5) #VALUE! Number
=WEBSERVICE(REPT("a",2100)) #VALUE! Text over 2048 chars, no scheme
=WEBSERVICE(Data!D1) #VALUE! Blank cell

The Data sheet these formulas read

A cell that starts with = holds that formula.

Watch out for

  • Returns #VALUE! on failure or if the response is too long (32767 characters).
  • Does not send custom headers or keys, so many APIs will not work.

Where it works

Excel
WEBSERVICE arrived in Excel 2013. Older versions do not have it. Windows only; not in Excel for Mac or the web.
Google Sheets
No direct equivalent: `IMPORTDATA / IMPORTXML`. Sheets has import functions rather than a raw text fetch.

Part of Web functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .