TSV to Google Docs Sync

Synchronizing TSV files with Google Docs.

Every once in a while one of those knobheads who don’t use org-mode (=rest of the world) require access to your data that’s beyond the occasional one-off export.

These people, being goal driven and sociable, tend to be a real nuisance. They would call & IM you, destroying what’s left of your precious attention span, and incur the wraths of the attention context switch upon you.

Realistically, you’ve got two options - switch to using something like google docs, thus cementing your existsance as no more than a slave to the corporate plankton. Or - you could come up with a way to push data from where it’s convenient for you to edit/generate/obtain/work it and over to their enterprisey la-la land.

Enter sheet_sync.py, a proof of concept for one way synchronization of tabular data in .TSV format locally, to a google docs spreadsheet.

Tested & found to be working on a sheet of > 400 rows.

There were a few points of pain while implementing this technological marvel:

  1. OAuth authentication. In order to access the sheet, you need a google service account, one you could create at the API console. Once you do, don’t forget to save the credentials .json locally (auth.json) & give that account permissions to whatever sheet you’re about to upload to.
  2. Rate limiting. Google’s pretty aggressive about that. Therefore the @rate_limited decorator to prevent you from shooting yourself in the foot.
  3. Synchronization logic. The approach chosen for this baby is by matching rows by composite keys. A composite key, in our case, is when a row matches by multiple specified columns. When extra rows are encountered - they are mercilessly deleted.

 You, dear reader, are more than welcome to use this as foundation for your own instruments of knobhead empowerment.

P.S - Be careful. If the sheet is re-sorted, filtered or otherwise manipulated during data sync, shit hits the fan. This is, for the most part, not meant as a tool for two-way communication.


© 2025 Web GMA R&D Ltd.