title: pandas Xlsxwriter dynamically access rows and Insert formatting and blanks rows with formula and chart
body: <p><strong>Target:</strong> So I have a data frame in excel like attached screenshot<a href="https://i.stack.imgur.com/Ho4tL.png" rel="nofollow noreferrer">enter image description here</a> and placed data in the path <a href="https://drive.google.com/open?id=1_I3W8ghNXPvbxF5VyMjY0IttkQzOMAq-" rel="nofollow noreferrer">enter link description here</a></p>
  
  <p><strong>Step 1:</strong> I want to insert 4 blanks rows after each different value of the first column  ["Placement# Name"] and on first blank row wanted to write a formula on selected columns like for column C, D, F, and H "=sum{}:{}" and apply formatting like currency or percent on selected column and mark bold and  put background colour on the same row. and put headers again on the second iteration. I also want to insert a combination of column and line chart at the same row where the first iteration start dynamically </p>
  
  <p><strong>Example attached to Step 1:</strong> <a href="https://i.stack.imgur.com/YyHHp.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p><strong>Step 2:</strong> As per step 1, it will happen till the last row.</p>
  
  <p><strong>Step 3:</strong> After getting done for each row add grand total based on rows for rows of Total</p>
  
  <p>so the expected output is like given data at path
         <a href="https://drive.google.com/open?id=1ZpB8XOAoi218ZnoK2wSOtqYX4wcq3758" rel="nofollow noreferrer">enter link description here</a>
         and screenshot <a href="https://i.stack.imgur.com/64QDy.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>So the column ["Placement# Name] values can be changed decrease or increase.</p>
  
  <p>The thing is I'm not able to put logic here how to loop through and do the step 1 till the last row.</p>
  
  <pre><code>for col in range(2,3):
              #cell_location = xl_rowcol_to_cell(number_rows_placement+number_rows_adsize+17, col)
              start_range = xl_rowcol_to_cell(1, col)
              end_range = xl_rowcol_to_cell(number_rows_daily,col)
              formula = "=SUM({:s}:{:s})".format(start_range, end_range)
              if final_day_wise['Placement# Name'].eq(final_day_wise['Placement# Name'].shift()):
  </code></pre>