Back to Google Analytics in Excel
SheetXAI logo
Google Analytics logo
Google Analytics · Excel Guide

Send Offline Events From Excel to GA4 via Measurement Protocol

The Scenario

You are a backend developer. Three thousand offline purchase events are sitting in an Excel workbook — each row has a client ID, a timestamp, a product SKU, and a revenue value. These are purchases from your company's retail locations last month that missed the GA4 client-side tag entirely.

Your GA4 property is the revenue source of truth. Without these events, last month's revenue in GA4 is off by roughly 40%. The board review is in six days.

You need to back-fill all 3,000 rows into GA4 using Measurement Protocol. That means looping every row, constructing the JSON payload, sending an HTTP POST to the endpoint, and logging the response back to the workbook — so you know which rows succeeded and which failed.

The bad version of the next few hours:

  • Write a Python script or Power Automate flow to loop the Excel rows
  • Figure out the Measurement Protocol v2 payload structure — the docs are dense
  • Handle the API secret authentication
  • Run a test batch, realize the timestamp column is in milliseconds and needs to be microseconds
  • Fix the conversion, re-test
  • Run the full 3,000 rows, find 47 failed because the client ID column has trailing spaces
  • Fix the spaces, re-send the 47 failures
  • Two hours later you have 3,000 rows sent but no confidence the timestamp conversion was right for all of them.

The fast version is one prompt.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent inside your Excel workbook that can loop every row, construct the Measurement Protocol payload, send the event to GA4, and write the response status back — in one operation.

Open the SheetXAI sidebar and type:

For every row in my workbook, send a purchase event to GA4 via Measurement Protocol. Use the client ID from column A, the timestamp from column B (convert to microseconds if it is in milliseconds), the product SKU from column C as the item ID, and the revenue value from column D. After sending each row, write "Sent" or the error message into the Status column (column E). Log the total count of successes and failures in cell G1 when done.

SheetXAI loops the rows, constructs each payload, handles the timestamp conversion, sends the requests, writes status per row, and logs the summary.

What You Get

A workbook with:

  • Column E (Status) — "Sent" for successful rows, or the GA4 error response for failures
  • Cell G1 — summary: "2,953 sent successfully, 47 failed"
  • Filterable failures — filter column E for anything that is not "Sent" to see exactly which rows need attention

Failures are logged, not dropped. The most common issues — invalid client ID format, malformed timestamp, missing required field — appear in column E so you can fix and re-send only the failed rows.

What If the Data Is Not Quite Ready

Offline event workbooks are rarely clean from the source system. SheetXAI handles the common issues inline.

When client IDs have trailing spaces

Your retail system exports client IDs with occasional trailing spaces that break Measurement Protocol validation.

Before sending, clean the client IDs in column A — trim whitespace and normalize to lowercase. Then send a purchase event per row via Measurement Protocol and write status to column E. Log success and failure counts in G1.

When timestamps are in local timezone instead of UTC

Your retail system logged timestamps in Eastern Time. GA4 Measurement Protocol expects UTC.

The timestamps in column B are in Eastern Time (UTC-5). Convert each one to UTC before constructing the Measurement Protocol payload. Send a purchase event per row, write status to column E, and log the summary in G1.

When you want to skip rows already sent

You ran a partial send last week. Some rows already have "Sent" in column E. You only want to send the remaining rows.

Skip any row where column E already contains "Sent." For all other rows, send a purchase event via Measurement Protocol using client ID from column A, timestamp from column B, SKU from column C, and revenue from column D. Write status to column E.

When you want the full back-fill plus a validation summary

You need the 3,000 events sent, status logged per row, success/failure counts, and a note about any systematic error pattern — all before you close your laptop.

Clean client IDs in column A (trim whitespace). Convert timestamps in column B from milliseconds to microseconds. Send a purchase event per row to GA4 via Measurement Protocol using client ID, timestamp, SKU (column C), and revenue (column D). Write "Sent" or the error message to column E. Log success and failure counts in G1. If more than 5 rows failed with the same error, write a note about that pattern in cell G2.

The pattern: instead of writing and debugging a script in two iterations, you describe the send operation in one prompt. The 3,000 rows go out, the statuses land in column E, and you know what to fix before the board review.

Try It

Get the 7-day free trial of SheetXAI and ask it to back-fill your offline events into GA4 from your workbook. The Google Analytics integration is included in every SheetXAI plan. See also how to export GA4 key events with counts for a tagging audit in Excel or the Google Analytics in Excel overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more