@benjbrandall

benjamin brandall's website

Convert Datetime to Epoch in CSV

24 Sep 2020 - benjamin

Since Google Sheets doesn’t have epoch as an option in its date formats, I wrote this script today to convert a huge column of datetimes in a .csv to epoch timestamps.

Pass a .csv file as the first argument and output to another. Then you can either paste straight over the old column or select the starting cell and do an import (in Sheets).

Pastebin of epoch.rb here

Usage:

ruby epoch.rb original_date.csv > epoch_date.csv