Skip to content

Instantly share code, notes, and snippets.

View empiricalthought's full-sized avatar
🎵

Steven Huwig empiricalthought

🎵
View GitHub Profile
PS1=[\d/\t] \h:\W \u$
@empiricalthought
empiricalthought / sample.py
Created December 21, 2017 21:29
openpyxl named range
from openpyxl import load_workbook
workbook = load_workbook(filename='./tmp/book.xlsx', read_only=True)
range = workbook.defined_names['a_named_range']
for sheet_title, sheet_coords in range.destinations:
sheet = workbook[sheet_title]
for row in sheet[sheet_coords]:
print "\t".join(str(cell.value) for cell in row)
#!/usr/bin/env awk -f
NR > 1 {
for (i = 1; i <= header_count; i++) {
print headers[i], $i
}
}
NR == 1 {
header_count = split($0, headers)