title: Dynamic Table Rows with docx-template
body: <p>Good day SO,</p>
  
  <p>I am trying to dynamically populate a Table in a .docx file. The table looks like:
  <a href="https://i.stack.imgur.com/QJno7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QJno7.png" alt="enter image description here"></a>
  Where there are N projects (1..N) and each project has N rows (1..N), making the structure like such:</p>
  
  <pre><code>table_data = [
  {
      'title':'Proj1',
      'rows':[
          {'col1':'col1txt',
          'col2':'col2txt',
          'col3':'col3txt',
          'col4':'col4txt',
          'col5':'col5txt',
          'col6':'col6txt'},
          {'col1':'col1txt',
          'col2':'col2txt',
          'col3':'col3txt',
          'col4':'col4txt',
          'col5':'col5txt',
          'col6':'col6txt'}
          ]
      },
      {..repeat..}
  ]
  
  context={'table_data':table_data}
  </code></pre>
  
  <p>I am currently using the python-docx-template library, and there are very few example online regarding nested tables. Can anyone guide me in the right direction?</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>SOLUTION:</p>
  
  <p>I found the information required for this nested table case at:
  <a href="https://github.com/elapouya/python-docx-template/blob/master/tests/templates/subdoc_tpl.docxhttps://github.com/elapouya/python-docx-template/blob/master/tests/templates/subdoc_tpl.docx" rel="nofollow noreferrer">https://github.com/elapouya/python-docx-template/blob/master/tests/templates/subdoc_tpl.docxhttps://github.com/elapouya/python-docx-template/blob/master/tests/templates/subdoc_tpl.docx</a></p>
  
  <p>and it's syntax at:
  <a href="https://github.com/elapouya/python-docx-template/blob/master/tests/dynamic_table.py" rel="nofollow noreferrer">https://github.com/elapouya/python-docx-template/blob/master/tests/dynamic_table.py</a></p>
  
  <p>Hope this helps somebody like me :) Good day!</p>
  
  <p><a href="https://i.stack.imgur.com/fmiUQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fmiUQ.png" alt="enter image description here"></a></p>