Extract Meta Ads detailed targeting across all endpoints using Google Sheets
Meta Ads Detailed Targeting Extractor (Universal, Switch by Endpoint) This workflow is a universal automation for all four Meta Detailed Targeting API endpoints: Search, Suggestions, Browse, and Validation. You use a ...
Template notes
Meta Ads Detailed Targeting Extractor (Universal, Switch by Endpoint)
This workflow is a universal automation for all four Meta Detailed Targeting API endpoints: Search, Suggestions, Browse, and Validation. You use a single Google Sheets tab with an endpoint column; a Switch node routes each row to the correct branch; results are written to four separate sheets in the same spreadsheet. It is designed for media buyers, performance marketers, and analysts who manage targeting research, audience suggestions, browse trees, and validation in bulk and want one workflow instead of four.
Use Case Working with Meta’s Detailed Targeting API usually means separate flows for search, suggestions, browse, and validation. This workflow is ideal if you want to: - Centralize targeting operations in one place: one input sheet, one workflow, four result sheets. - Drive everything from Google Sheets: add rows with endpoint (search | suggestions | browse | validation), adaccountid, and endpoint-specific parameters; run manually or on new rows. - Keep results organized by endpoint: searchresults, suggestionsresults, browseresults, validationresults in the same document. - Run on demand or on row add: use Manual Trigger for full-sheet runs or Google Sheets Trigger to process only new rows.
How it Works
The workflow is organized into clear blocks:
1. Trigger & input - Manual Trigger → Read Input (Google Sheets) — reads the entire targetingrequests sheet for ad-hoc or test runs. - Google Sheets Trigger — runs when a new row is added to targetingrequests; only new rows are processed (no re-processing of existing data). - Read Input (Google Sheets) always reads from the same sheet: targetingrequests.
2. Validation & routing - Valid rows (adaccountid + endpoint) — Filter node keeps only rows where both adaccountid and endpoint are non-empty. - Switch by endpoint — routes each row to one of four branches based on endpoint: search, suggestions, browse, or validation (values must match exactly, including case).
3. Each branch (Search, Suggestions, Browse, Validation) - API (Facebook Graph API) — calls the corresponding edge: targetingsearch, targetingsuggestions, targetingbrowse, or targetingvalidation with parameters from the row (act{adaccountid}/...). - Merge (combine by position) — merges the API response with the original request row so each result keeps context (e.g. adaccountid, q, targetinglist). - Split (field: data) — expands the API data array into one item per targeting result. - Format — maps fields to flat columns for the sheet: endpoint, adaccountid, query, limittype, targetingid, targetingname, audiencesizelowerbound, audiencesizeupperbound, path, description, type; for Validation branch, valid is also included. - Save to Google Sheets — appends to the branch-specific sheet: searchresults, suggestionsresults, browseresults, or validationresults.