What the video covers
Office & Google Workspace
Watch the video on YouTubeStep-by-step instructions
- Open or create a Google Sheet
Open a new or existing spreadsheet in Google Sheets to hold URLs and extracted headings. - Put the target URL in a cell
Enter the webpage address you want to audit into a cell (for example, A2). - Extract H1 tags
In the desired output cell (for example, B2) enter: =IMPORTXML(A2, "//h1") and press Enter. The sheet will populate with all H1 text nodes found in that page's HTML. - Extract H2 and H3 tags
In separate cells enter: =IMPORTXML(A2, "//h2") and =IMPORTXML(A2, "//h3") to pull secondary and tertiary headings respectively. - Optional — show results across columns
If the IMPORTXML result spills down rows but you want headings across columns, wrap with TRANSPOSE, for example: =TRANSPOSE(IMPORTXML(A2, "//h2")) to lay H2s horizontally. - Optional — add a clean fallback for missing tags
Wrap the call with IFERROR to show a friendly message instead of an error, e.g.: =IFERROR(IMPORTXML(A2, "//h1"), "No H1 Found"). - Scale to multiple pages
Place each target URL on its own row (e.g., column A) and copy the IMPORTXML formulas across corresponding columns to build a multi-page heading audit sheet. Be mindful of request limits and throttling.
Watch the video
Play tutorial
Why it matters
Manually inspecting page source for headings is slow and repetitive. IMPORTXML lets you pull heading tags directly into your sheet so you can audit page structure, compare pages, or feed headings into further analysis automatically.
Check your result
Successful extraction fills the target cell(s) with the page's H1, H2 or H3 text. If a tag type is absent you should see your fallback text (if you used IFERROR) or a clear error message.
Troubleshooting
– #N/A or empty results: page may be dynamically generated (client-side JavaScript) — IMPORTXML cannot load content created after initial page HTML. Use a server-side scraper or export static HTML instead. – #ERROR or parsing issues: malformed XPath or unexpected HTML. Ensure you use double slashes and lowercase tag names (e.g., //h1). – Access blocked or empty: site may block automated requests or require authentication. Confirm the URL is publicly accessible in a normal browser and not behind login/geo-blocks. – Too many requests: Google may throttle repeated IMPORTXML calls across many URLs — add delays, split into batches, or use an Apps Script solution for large crawls. – Multiple headings appear down rows: use TRANSPOSE to place results across columns instead of down rows, or wrap results in INDEX to pick a specific occurrence.