Skip to content
ScrapeField

Blog · Guides ·

From Google Maps links to place data

A column of Google Maps links becomes a table: each place's id, address, phone, website, rating and opening hours. One call per link, and a short link is the only thing to watch for.

ScrapeField

A list of places often starts as links: copied from a browser, collected in a sheet, sent by a colleague. This guide turns each link into the place itself, one call per link.

Which links work

GET /v1/google-maps/place takes a url as well as a place_id. A link works when it carries the place’s id, as the long address in the browser bar does, or a link of the form https://www.google.com/maps/place/?q=place_id:…. A short share link, maps.app.goo.gl/…, carries no id: open it once in a browser and copy the long address it leads to. Sent as it is, it comes back as invalid_parameter, and is refunded.

The loop

const links = [
  'https://www.google.com/maps/place/?q=place_id:ChIJN1t_tDeuEmsRUsoyG83frY4',
  // the rest of your column
];
const headers = { Authorization: `Bearer ${process.env.SCRAPEFIELD_KEY}` };

// one row per link, in the order of your column
const rows = [];
for (const link of links) {
  const res = await fetch(`https://api.scrapefield.com/v1/google-maps/place?url=${encodeURIComponent(link)}`, { headers });
  const body = await res.json();
  if (!res.ok) { rows.push([link, body.error.code]); continue; }
  const p = body.data;
  rows.push([link, p.place_id, p.name, p.formatted_address, p.formatted_phone_number, p.website, p.rating,
    (p.opening_hours?.weekday_text ?? []).join('; ')]);
}
console.log(rows.map((r) => r.join('\t')).join('\n'));

Each link costs 3 credits: 1,000 links are 3000 credits, $2.34 on the smallest pack. A link that fails is refunded. The rows are in the order of your column, and a link that failed says why in its own row. For a long column, run several calls side by side, up to your limit of calls at once.

Keep the place_id

Store place_id next to each link. It is Google’s own id, it does not change, and from then on every call can use it instead of the link: the place again, its reviews, or a weekly check of its rating. Every field the place has is in the place reference.