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

Backfill Historical Events Into Segment With Original Timestamps From a Google Sheet

The Scenario

You are a data analyst. Your company switched email platforms two years ago, and the old platform's engagement history never made it into Segment.

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 in the funnel.

You have 5,000 rows in an Excel workbook 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 appear in March 2024, not May 2026.

The slow version:

  • Write a script that reads the workbook and calls Segment's import endpoint with the timestamp field set from column C
  • Handle Excel date serial number conversion to ISO 8601
  • Batch the requests, handle retries, write errors somewhere
  • Discover on Friday afternoon 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 workbook and calls Segment's API with the original timestamps from the workbook, so you do not have to write the import script or convert date formats yourself.

Open the SheetXAI sidebar and type:

Import all 5,000 rows from the Email Events tab 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 tab, sends each event with the original timestamp from column C set as the Segment event time, and writes 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. SheetXAI sends the timestamp field in the Segment payload from the value in the workbook.

What If the Data Is Not Quite Ready

Historical exports always have timestamp problems. SheetXAI handles them in the same prompt.

When timestamps are stored as Excel serial numbers

Excel dates are stored as numeric serial numbers (e.g., 45350) rather than ISO 8601 strings.

Convert all values in column C from Excel date serial numbers to ISO 8601 format before sending. Then import all rows from the Email Events tab into Segment using userId from column A, event name from column B, and the converted timestamp. 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.

Import all rows from the Email Events tab 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

Opens, clicks, and unsubscribes are all mixed in the tab. The attribution model only needs opens 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

Some rows have empty, malformed, or "N/A" timestamps 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 Excel serial number format to ISO 8601 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 SheetXAI handles both in one instruction.

Try It

Get the 7-day free trial of SheetXAI and open any workbook 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 Excel overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more