Back to Route4Me in Excel
SheetXAI logo
Route4Me logo
Route4Me · Excel Guide

Create Route4Me Territories and Avoidance Zones From a Google Workbook

The Scenario

You are a field-service operations manager. Monday dispatch starts in three days. You have 15 new service territories defined in an Excel workbook, the result of a two-week territory rebalancing.

The Territories tab has columns: name, shape type (circle, rect, or polygon), and coordinate lists. Every one of them needs to be created in Route4Me before the dispatch team starts assigning routes, and the returned territory_id needs to go back into column E.

The bad version of this weekend:

  • You open Route4Me's territory manager and start creating each one by hand
  • The polygon territories require you to paste coordinate pairs one at a time into a map interface
  • You get through six before an input error creates a territory covering the wrong area
  • You delete it, restart, and lose track of which IDs match which names
  • Dispatch starts Monday and only nine of fifteen territories exist in Route4Me.

The fast version is one prompt.

The Easy Way: One Prompt in SheetXAI

SheetXAI reads each row of your Territories tab and creates the corresponding Route4Me territory, writing the returned territory_id back to column E as it goes.

Open the SheetXAI sidebar and type:

For each row in my Excel Avoidance Zones table with columns zone_name, lat, lng, radius_km, create a circular Route4Me avoidance zone and write the returned territory_id back to column E.

SheetXAI reads all 15 rows, calls Route4Me's territory API for each with the right shape type and coordinates, and writes the territory_id back to column E. All territories exist in Route4Me before Friday afternoon.

What You Get

A fully created set of territories with IDs written back:

  • Column E — Route4Me territory_id for each row, written back as each territory is created
  • Route4Me account — 15 new territory entries with correct shapes and boundaries
  • Errors flagged — any row that fails due to invalid coordinates gets a note in column E instead of an ID

The IDs are matched to the right rows. No manual cross-reference needed. SheetXAI writes each ID to the row it read the definition from.

Need avoidance zones alongside service territories? Add a second tab and tell SheetXAI to create both in the same prompt.

What If the Data Is Not Quite Ready

Territory boundary data from rebalancing exercises is often inconsistent. SheetXAI handles cleanup and creation in the same prompt.

When coordinate lists have inconsistent formatting

Some polygon rows have coordinates as "lat,lng lat,lng lat,lng" and others as semicolon-separated "lat,lng;lat,lng;lat,lng."

Normalize the coordinate format in the coordinates column to a consistent space-separated list before creating each territory. Then create all Route4Me territories in the Territories tab and write the territory_id to column E.

When some rows are missing shape type

A few rows have coordinates but no shape value. Based on coordinate count, the shape can be inferred.

For rows in the Territories tab missing a shape type, infer it: if there is a single lat/lng pair plus a radius value, treat it as a circle. If there are exactly four coordinate pairs, treat it as a rect. Otherwise treat it as a polygon. Create all Route4Me territories and write the territory_id to column E.

When you only want to create territories for a specific region

The workbook has territories for all five regions, but today you only need the ones flagged as "Central" in column F.

Filter the Territories tab to rows where column F equals "Central." Create a Route4Me territory for each filtered row and write the returned territory_id to column E.

When you need to create both territories and avoidance zones from the same workbook in one shot

Column G has a "Type" field: "territory" for service areas and "avoidance" for zones to exclude. The coordinate format is the same for both types.

For each row in the Territories tab where column G is "territory," create a Route4Me service territory. For each row where column G is "avoidance," create a Route4Me avoidance zone. Use name, shape, and coordinates columns for both. Write the returned territory_id or avoidance_zone_id to column E. Flag any row with an unrecognized type value.

The pattern: instead of switching between Route4Me's territory manager and avoidance zone tools, you describe the full boundary setup in one prompt.

Try It

Get the 7-day free trial of SheetXAI and open any Excel workbook with territory or zone boundary data, then ask it to create them in Route4Me. The Route4Me integration is included in every SheetXAI plan. For related workflows, see how to bulk import addresses into the Route4Me address book in Excel or the Route4Me in Excel overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more