please forgive me if this is an ignorant question. I am fairly new to coding and Python and I have been trying all day to figure this out.
I am trying to write a script where the user provides a list of sheet-names and I will create an Excel workbook and a sheet in the workbook for each sheet-name provided. While coding, I wanted to use a variable (like ws1) to refer to each worksheet, but I don't know ahead of time how many sheets will be required...depends on how many names user provides.
So I am currently using 'len' to get the count of names in the list (and to know how many sheet-name variables I will need (ie. ws1, ws2, etc.). I thought I would run a loop to assign each sheet-name to one of the variables (that I want to create on-the-fly, but I haven't been able to find info how to do this.
Each variable will begin with 'ws' followed by the next available number (1,2,3, etc) until the range is complete. I thought I would concatenate using something like this:
counter = 0
for i in range(len(sheet_names_lst)):
sht_name="ws%d: % (i+1)
'ws'+counter = wb.create_sheet("mysheet_one")
...but I get an error "Expression cannot be assignment target"
Any help would be greatly appreciated. Thanks CB