Skip to content

Instantly share code, notes, and snippets.

@mfcovington
Created July 6, 2016 00:50
Show Gist options
  • Save mfcovington/5306b736d33fd5db62377dcf417d953e to your computer and use it in GitHub Desktop.
Save mfcovington/5306b736d33fd5db62377dcf417d953e to your computer and use it in GitHub Desktop.
Parse Excel Submission Form
from openpyxl import load_workbook
wb = load_workbook(filename = 'SubmissionForm.xlsx')
sheet = wb.get_sheet_by_name(wb.sheetnames[0])
header_row = sheet.rows[0]
for row in sheet.rows[1:]:
# Ignore empty rows
if row[0].value is None:
continue
for header, cell in zip(header_row, row):
if header.value is None:
continue
print('{}\n\t{}'.format(header.value, cell.value))
@mfcovington
Copy link
Author

Output:

Sample Name (no caps)
    example123
Species
    Homo Sapiens
Type of sample (Cell, Tissue DNA/RNA, etc.)
    HEK293T DNA Extract
Researcher 
    John Smith
Concentration [ng/uL] (if applicable)
    100 ng/uL
Service (Select from drop-down menu)
    DNA seq
Volume (if applicable)
    75 uL
Dissolved in (select from drop-down menu)
    TE Buffer
Additional Notes
    cells are mutated with radiation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment