Ask coding questions

← Back to all posts
creating an inventory in python and excel
saqer (0)

Make an inventory for Excel from Python

import the excel package

import xlwt
from xlwt import Workbook

Create a new workbook

wb = Workbook()

Make a sheet in the workbook

sheet1 = wb.add_sheet('Sheet 1')

Inventory header

sheet1.write(0,0,'ITEM')

set up the counter to allow the inventory to be input

i = 1

run a loop forever to allow inventory input

while 1:
g = input() # take anything from the keyboard
sheet1.write(i,0,g)
wb.save('inventorysheet.xls')
i += 1

Voters
saqer (0)
Commentshotnewtop
ash15khng (393)

1) post this in a repl
2) tell us what's wrong with the code
3) tell us what you want to do

mwilki7 (278)

Is this a tutorial or a question?