The Scenario
You are a data analyst. Your company switched email platforms two years ago, and the old system's engagement history — opens, clicks, unsubscribes — never made it into Segment.
Now the growth team wants to run a re-engagement model against the full email history, but Segment's cohort analysis only goes back to the migration date. The prior two years look like a dead zone.
You have 5,000 rows in a Google Sheet exported from the old platform: user ID in column A, event name in column B, and the original event timestamp in column C. Some rows also have a campaign_id in column D.
If the events land in Segment with today's timestamp, the attribution is wrong. The open from March 2024 needs to show up in March 2024, not May 2026. The import has to preserve the original dates.
The slow version:
- Write a script that reads the sheet and calls Segment's import endpoint with the
timestampfield set from column C - Handle the date format conversion — the old platform exported timestamps as Unix milliseconds, not ISO 8601
- Batch the requests, handle retries, write errors back somewhere
- Run it on Friday afternoon. Discover that 400 rows had malformed timestamps. Fix it over the weekend.
The fast version is one prompt.
The Easy Way: One Prompt in SheetXAI
SheetXAI reads the sheet and calls Segment's API with the original timestamps from the sheet, so you do not have to write the import script or convert the date formats yourself.
Open the SheetXAI sidebar and type:
Import all 5,000 rows from the Email Events sheet into Segment as historical data using userId from column A, event name from column B, and original timestamp from column C. Preserve the original timestamps exactly — do not use the current time. Write SENT or ERROR into column D per row.
SheetXAI reads the full sheet, sends each event with the original timestamp from column C set as the Segment event time, and writes the result status to column D.
What You Get
5,000 Segment track events with original timestamps and row-level status in column D:
- SENT for every row Segment accepted with the original date
- ERROR for any row that failed, with the reason
- Accurate attribution — March 2024 opens appear in March 2024 in Segment's funnel analysis
The timestamp from column C is used as the Segment event timestamp, not the time the call was made. This is the critical difference between a backfill and a new event. SheetXAI handles this by sending the timestamp field in the Segment payload using the value from the sheet.
What If the Data Is Not Quite Ready
Historical exports always have timestamp problems. SheetXAI handles them in the same prompt.
When timestamps are in Unix milliseconds
The old platform exported timestamps as 13-digit Unix milliseconds (e.g., 1710432000000) instead of ISO 8601 strings.
Convert all values in column C from Unix milliseconds to ISO 8601 format before sending. Then import all rows from the Email Events sheet into Segment using userId from column A, event name from column B, and the converted timestamp from column C. Write SENT or ERROR into column D.
When campaign IDs need to be included as a property
Some rows have a campaign_id in column D and others have it blank. You want it included as an event property where it exists.
Import all rows from the Email Events sheet into Segment as historical track events. Use userId from column A, event name from column B, and original timestamp from column C. Where column D is not blank, include campaign_id from column D as an event property. Write SENT or ERROR into column E.
When you only want to backfill one event type first
You have opens, clicks, and unsubscribes all mixed in the sheet. The attribution model only needs the opens for now.
Filter to rows where column B is "Email Opened" only. Import those rows into Segment as historical data using userId from column A, event name from column B, and original timestamp from column C. Write SENT or ERROR into column D.
When timestamps are malformed on some rows and you need cleanup plus import in one pass
A few hundred rows have timestamps that are empty, malformed, or show as "N/A" from a bad export.
Check column C for rows where the timestamp is blank, non-numeric, or equal to "N/A." Write SKIPPED into column D for those rows. For all valid rows, convert the timestamp from Unix milliseconds to ISO 8601 format and import them into Segment as historical events using userId from column A, event name from column B, and the converted timestamp. Write SENT or ERROR into column D.
The pattern: describe the bad rows, describe what valid looks like, and ask SheetXAI to handle both in one instruction.
Try It
Get the 7-day free trial of SheetXAI and open any sheet of historical events with original timestamps, then ask it to backfill them into Segment with the correct dates. The Segment integration is included in every SheetXAI plan. For related workflows, see how to bulk-track offline events or the Segment in Google Sheets overview.
