Skip to content

Instantly share code, notes, and snippets.

@offby1
Forked from anonymous/invoice.py
Last active December 16, 2015 21:48
Show Gist options
  • Save offby1/f435a9a8cbb890d638b0 to your computer and use it in GitHub Desktop.
Save offby1/f435a9a8cbb890d638b0 to your computer and use it in GitHub Desktop.
import collections
itemData = collections.defaultdict(list)
print('Reading rows...')
for row in range(10, 19):
# Each row in the spreadsheet has data for one item.
item = sheet['A' + str(row)].value
itemData['item'].append(item)
description = sheet['C' + str(row)].value
itemData['description'].append(description)
ordered = sheet['J' + str(row)].value
itemData['ordered'].append(ordered)
invoiced = sheet['M' + str(row)].value
itemData['invoiced'].append(invoiced)
rate = sheet['N' + str(row)].value
itemData['rate'].append(rate)
barcode = sheet['P' + str(row)].value
itemData['barcode'].append(barcode)
amount = sheet['R' + str(row)].value
itemData['amount'].append(amount)
print('{0: <16}'.format(item) + '{0: <24.20}'.format(description) +
'{0: <4}'.format(ordered) + '{0: <3}'.format(invoiced) +
'{0: <3}'.format(invoiced) + '{0: <13}'.format(barcode) +
'{0: <4}'.format(amount))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment