Skip to content

Instantly share code, notes, and snippets.

@rufuspollock
Created November 7, 2011 19:05
Show Gist options
  • Save rufuspollock/1345831 to your computer and use it in GitHub Desktop.
Save rufuspollock/1345831 to your computer and use it in GitHub Desktop.
Get user stories out a spreadsheet and into mediawiki syntax
# Get user stories out a spreadsheet and into mediawiki syntax
#
# Designed for this set here
# https://docs.google.com/spreadsheet/ccc?key=0Aon3JiuouxLUdFhMVEVFWXhxWXRKaU04LUF2ZTVsTVE&hl=en_GB#gid=0
# Pass it link to gdocs csv as argument on command line
# E.g.
#
# python userstories.py "https://docs.google.com/spreadsheet/pub?hl=en_GB&hl=en_GB&key=0Aon3JiuouxLUdFhMVEVFWXhxWXRKaU04LUF2ZTVsTVE&single=true&gid=0&output=csv"
#
import urllib
import csv
import sys
if not len(sys.argv) > 1:
print 'You must supply a url to google docs csv'
sys.exit(1)
url = sys.argv[1]
fo = urllib.urlopen(url)
out = ''
reader = csv.reader(fo)
reader.next()
for row in reader:
if not row:
continue
usnum = row[0][1:]
persona = row[1]
want = row[2]
result = row[3]
tags = row[4]
value = row[8]
comments = row[9]
status = row[11]
out += """
== %s %s ==
As a '''%s''' I want to '''%s''' so that '''%s'''
* Value: %s
* Status: %s
* Tags: %s
* Comments from dev: %s
""" % (
usnum, want,
persona, want, result,
value, status, tags, comments
)
print out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment