Parses an XML string into a document object.
class XmlService method .parse()
XmlService is the Apps Script service.
.parse() is the method name you will see after a dot in your code.
What it does
Why it's used
- Read XML feeds or legacy API responses.
- Turn supplier or government XML into something you can loop over.
Common errors
- Forgetting parentheses on parse. Write XmlService.parse(), not XmlService.parse or parse by itself.
- Skipping dots between chained calls. Each step needs a dot, like XmlService.parse().
- Adding spaces where they do not belong. Write XmlService.parse(), not XmlService .parse(), XmlService.parse (), or XmlService . parse().
- Wrong capitalization. Use XmlService and parse, not xmlservice or parse.
Explore
Related methods
-
.createDocument()
Creates a new empty XML document.
-
.createElement()
Creates a new XML element with a tag name.
-
.getPrettyFormat()
Returns a formatter that prints XML with indentation.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.