Reputation: 59
Is there a function to fill down a column? I am trying to write a formula into C2 and then want it to fill down to the end of the data. I feel that there is an easy way to do this, but I haven't found anything through googling yet. Any help is appreciated!
worksheet.write(1,2, '=IF(ISNUMBER(SEARCH("21",B2)),"x","")')
That is the code that I have to fill C2 with. Then I want that formula to fill down adjusting the B2 as it fill down. Just as it would if you double-clicked the bottom right corner of the cell in excel.
Upvotes: 2
Views: 2884
Reputation: 41644
You could do this using a simple loop and one of the XlsxWriter utility functions:
import xlsxwriter
from xlsxwriter.utility import xl_rowcol_to_cell
workbook = xlsxwriter.Workbook('test.xlsx')
worksheet = workbook.add_worksheet()
for row_num in range(1, 10):
cell = xl_rowcol_to_cell(row_num, 1)
formula = '=IF(ISNUMBER(SEARCH("21",%s)),"x","")' % cell
worksheet.write(row_num, 2, formula)
workbook.close()
Upvotes: 1