Skip to content

Instantly share code, notes, and snippets.

@philcali
Created December 6, 2019 00:18
Show Gist options
  • Save philcali/e62ec9dc36982753f1e0b01e29fc5420 to your computer and use it in GitHub Desktop.
Save philcali/e62ec9dc36982753f1e0b01e29fc5420 to your computer and use it in GitHub Desktop.
Simple script to output multiple files from Google form submissions.
import csv
import sys
with open(sys.argv[1]) as csvfile:
reader = csv.reader(csvfile)
rows = list(reader)
headers = rows[0][2:]
answers = rows[1:]
for answer in answers:
content = answer[2:]
name = content[0]
with open(name + ".txt", "w") as f:
for i in range(0, len(headers)):
f.write(headers[i])
f.write("\n")
f.write(content[i])
f.write("\n\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment