Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Grab a row from an Excel spreadsheet and output it. Useful for extracting test cases for OpenElections loaders from source results.
#!/usr/bin/env python
import argparse
import xlrd
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Extract rows from an Excel '
parser.add_argument('filename', nargs=1,
help='Excel file to load row from')
parser.add_argument('rows', nargs='+',
help='Row numbers to extract')
args = parser.parse_args()
sheet = xlrd.open_workbook(args.filename[0]).sheets()[0]
for row_index in args.rows:
row_index = int(row_index)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.