Python - Excel: Finding The First Empty Row In A Column
working from my last question I've managed to get a good chunk of the way to get my system finished. Of course I've run across a problem. I basically have a program that plays a ga
Solution 1:
My answer to this question a few days ago is very relelvant.
Basically whats going wrong is that xlrd
and xlwt
are different modules with different objects. The object you read in with xlrd.open_workbook()
IS NOT the same object which xlwt
knows how to write to
To get around this, theres the copy function in xlutils
.
from xlutils.copy import copy
import os
wb = xlrd.open_workbook(name)
# Code to find the last open cell
wb = copy(wb) #This is the important line!
sheet = wb.get_sheet(num) #num is the index of the sheet you want to edit
sheet.write(whatever you want to write)
wb.save(name)
Post a Comment for "Python - Excel: Finding The First Empty Row In A Column"