Skip to content

Instantly share code, notes, and snippets.

@jfhbrook
Created March 6, 2010 00:29
Show Gist options
  • Save jfhbrook/323350 to your computer and use it in GitHub Desktop.
Save jfhbrook/323350 to your computer and use it in GitHub Desktop.
A quick lil' python script that uses gnumeric's ssconvert and the standard library's csv to, y'know, show me the contents of gnumeric files wif less.
#!/usr/bin/env python
from os import system
from re import sub
from sys import argv
from csv import reader, writer
def main(filename):
system('ssconvert -T Gnumeric_stf:stf_csv '+filename+' /tmp/ssconv1.csv')
read = reader(open('/tmp/ssconv1.csv','r'), 'excel')
write = writer(open('/tmp/ssconv2.csv','r+'), 'excel-tab')
for line in read:
write.writerow(line)
system('less /tmp/ssconv2.csv')
if __name__ == '__main__':
main(argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment