title: For Loop for Openpyxl Chart Position
body: <p>I am trying to make a for loop to iterate through a list of chart names and positions to make it easier to add charts to excel using openpyxl. Here is what I have tried so far.</p>
  
  <pre><code>from openpyxl import Workbook
  from openpyxl.chart import BarChart, Reference, Series
  
  def trysomething():
  
      letterlist=['B', 'J', 'R', 'Z']
      numlist=[22, 38, 54, 70]
      position=[]
      for k in letterlist:
          for l in numlist:
              pos = k+str(l)
              position.append(pos)
  
      chartlist=['chart']
      chartnum=[]
      for j in range(1,6):
          chartnum.append(j)
  
      cha=[]
      for h in chartlist:
          for s in chartnum:
              ch=h+str(s)
              cha.append(ch)
  
      wb = Workbook()
      ws = wb.active
      for i in range(10):
          ws.append([i])
  
      values1 = Reference(ws, min_col=1, min_row=1, max_col=1, max_row=10)
      chart1 = BarChart()
      chart1.add_data(values1)
  
      values2 = Reference(ws, min_col=1, min_row=1, max_col=1, max_row=10)
      chart2 = BarChart()
      chart2.add_data(values2)
  
      values3 = Reference(ws, min_col=1, min_row=1, max_col=1, max_row=10)
      chart3 = BarChart()
      chart3.add_data(values3)
  
      values4 = Reference(ws, min_col=1, min_row=1, max_col=1, max_row=10)
      chart4 = BarChart()
      chart4.add_data(values4)
  
      values5 = Reference(ws, min_col=1, min_row=1, max_col=1, max_row=10)
      chart5 = BarChart()
      chart5.add_data(values5)
  
      for a, b in zip(iter(cha), iter(position)):
           print(a,b)
           ws.add_chart(str(a), str(b))
  
       wb.save("SampleChart.xlsx")
  
  trysomething()
  </code></pre>
  
  <p>When I print(a,b) it outputs the correct chart with the correct chart position, however, I does not work for adding the chart. </p>
  
  <p>Any help is appreciated!</p>