Skip to content

Instantly share code, notes, and snippets.

@oscarb
Last active March 27, 2024 19:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save oscarb/c9f2abfdc2c44da0b151 to your computer and use it in GitHub Desktop.
Save oscarb/c9f2abfdc2c44da0b151 to your computer and use it in GitHub Desktop.
Formula to check if URL in cell A1 in a Google Spreadsheet is valid HTML, using the W3C HTML Checker API

Validate URL in a Google Spreadsheet

Formula to check if URL in cell A1 in a Google Spreadsheet is valid HTML, using the W3C HTML Checker API

Formula

=IF(A1<>"", IF(INDEX(IMPORTDATA("https://validator.w3.org/nu/?out=json&doc=" & A1), 0, 2) = "messages:[]}", "✓", "✗"), "") 

Output

  • if no messages (errors or warnings) was returned
  • if one or more messages (errors or warnings) was returned
  • (empty) if the cell A1 is empty

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment