for row in (1, 4): sheet.merge_cells(start_row=row, start_column=1, end_row=row, end_column=9) # Note: for row in (2, 3, 5): for scol, ecol in zip(range(2, 9, 2), range(3, 10, 2)): sheet.merge_cells(start_row=row, start_column=scol, end_row=row, end_column=ecol)note that f-string is just a way to create the string. It should not interfere with openpyxl. Here is the example from post#7 with str.format method
for row in range(10, 13): for col1, col2 in zip('BDFH', 'CEGI'): print('{0}{2}:{1}{2}'.format(col1, col2, i))if you have issue, show us what the problem is, pretty sure it's not the f-string. If openpyxl accept string as input to sheet.merge it does not matter how you construct the string or even if you just pass a variable.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs