I found that the best way to parse html in google apps is to avoid using XmlService.parse or Xml.parse.
XmlService.parse doesn't work well with bad html code from certain websites.
Here a basic example on how you can parse any website easily without using XmlService.parse or Xml.parse.
1- Create a new Google Sheet;
2- Click the menu Tools > Script editor... to open a new tab with the code editor window and copy the following code into your Code.gs:
3- Add an HTML file to your Apps Script project.
11 Google Sheets Automations - Examples, Scripts and Add Ons
Open the Script Editor and choose File > New > Html File, and name it 'test'.Then copy the following code into your test.html
4- Save your gs and html files and Go back to your spreadsheet. Reload your Spreadsheet.
Click on "Parse Menu" - "Parse". Then click on "Click here to get list" in the sidebar.
answered Jan 14 '17 at 17:12
10444 bronze badges