Thank you, thanks so much. It's really hard being a new coder, who's not natural at it, but driven.
It seems when one question is answered, two others are not being solved.
I'm getting there
Next question:
Why can't I change the active sheet?
Here's the code:
How do you change the active sheet to be able to write to it?
I owe you beers!
Phil
Can I explain this code out?
I see the zip() defination but it's still not clear (must be 02:30am!):
Is my description correct? What am I missing?
Thanks,
phil
It seems when one question is answered, two others are not being solved.
I'm getting there

Next question:
Why can't I change the active sheet?
Here's the code:
# create workbook wb = openpyxl.Workbook() print('all.sheetnames:', wb.sheetnames) # set sheets sheet = wb.active sheet.title = 'Daily_Rounds' s0 = sheet s1 = wb.create_sheet('Colors') print('all.sheetnames:', wb.sheetnames) print('wb.index(s0/Daily_Rounds) =', wb.index(s0)) print('wb.index(s1/Colors) =', wb.index(s1)) # help: how do you change the active sheet? print('sheet/wb.active =', sheet) wb.active = wb.index(s1) print('sheet/wb.active =', sheet)I've tried a number of different combinations, discovered how to index through the active sheet cells, all without changing the sheet from 'Daily Rounds' to 'Colors'.
How do you change the active sheet to be able to write to it?
I owe you beers!

Phil
Can I explain this code out?
start_col = [2, 4, 6, 8] end_col = [x + 1 for x in start_col] for i in range(1, 6): if i in [1, 4]: sheet.merge_cells(start_row=i, start_column=1, end_row=i, end_column=9) else: for col1, col2 in zip(start_col, end_col): sheet.merge_cells(start_row=i, start_column=col1, end_row=i, end_column=col2)
- Create a 'start' list with 2, 4, 6, & 8 integers
- create an 'end' list that adds +1 for every integer in the 'start' list
- For every value (named i) within the range 1 to 6, but not including 6:
- if i is either 1 or 4:
- merge cells starting with row range from 1 to 5, going from columns 1 to 9
- or else:
- for variables col1 & col2 in the zip() function calling start_col & end_col:
- merge cells within row i (range from 1 to 5), going from col1 to col2
I see the zip() defination but it's still not clear (must be 02:30am!):
Quote:The zip() function take iterables (zero or more), makes iterator that aggregates elements based on the iterables passed, and returns an iterator of tuples.
Return Value from zip()
The zip() function returns an iterator of tuples based on the iterable object.
If no parameters are passed, zip() returns an empty iterator
If a single iterable is passed, zip() returns an iterator of 1-tuples. Meaning, the number of elements in each tuple is 1.
If multiple iterables are passed, ith tuple contains ith Suppose, two iterables are passed; one iterable containing 3 and other containing 5 elements. Then, the returned iterator has 3 tuples. It's because iterator stops when shortest iterable is exhaused.
Is my description correct? What am I missing?
Thanks,
phil