Skip to content

Instantly share code, notes, and snippets.

@dbspringer
Created July 21, 2015 18:30
Show Gist options
  • Save dbspringer/643254008e6784aa749e to your computer and use it in GitHub Desktop.
Save dbspringer/643254008e6784aa749e to your computer and use it in GitHub Desktop.
Python one-liner to convert spreadsheet column to zero-based index. e.g. 'A' -> 0, 'AA' -> 26, etc
col2num = lambda col: reduce(lambda x, y: x*26 + y, [ord(c.upper()) - ord('A') + 1 for c in col])-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment