title: Creating a list from python output - add it to excel
body: <p>I am running the following script:</p>
  <pre><code>    steps = data['features'][0]['properties']['segments'][0]['steps']
      
      values = data['features'][0]['properties']['extras']['waycategory']['values']
      
      print(values)
      
      print(steps)
  </code></pre>
  <p>to get this output:</p>
  <pre><code>[]
  [{'distance': 0.0, 'duration': 0.0, 'type': 11, 'instruction': 'Head east', 'name': '-', 'way_points': [0, 0]}]
  [[0, 33, 0], [33, 94, 3], [94, 99, 0], [99, 134, 3], [134, 151, 1], [151, 162, 3], [162, 176, 1], [176, 185, 0], [185, 220, 1], [220, 227, 3], [227, 230, 0]]
  [{'distance': 51.9, 'duration': 12.5, 'type': 11, 'instruction': 'Head southwest', 'name': '-', 'way_points': [0, 2]}, {'distance': 275.6, 'duration': 39.6, 'type': 0, 'instruction': 'Turn left onto Hetzendorfer Straße', 'name': 'Hetzendorfer Straße', 'way_points': [2, 13]}, {'distance': 162.6, 'duration': 28.2, 'type': 4, 'instruction': 'Turn slight left onto Hetzendorfer Straße', 'name': 'Hetzendorfer Straße', 'way_points': [13, 20]}, {'distance': 367.6, 'duration': 41.0, 'type': 1, 'instruction': 'Turn right onto Altmannsdorfer Straße, B224', 'name': 'Altmannsdorfer Straße, B224', 'way_points': [20, 33]}, {'distance': 1152.0, 'duration': 112.3, 'type': 13, 'instruction': 'Keep right', 'name': '-', 'way_points': [33, 57]}, {'distance': 1011.6, 'duration': 81.3, 'type': 13, 'instruction': 'Keep right', 'name': '-', 'way_points': [57, 79]}, {'distance': 358.5, 'duration': 37.4, 'type': 13, 'instruction': 'Keep right', 'name': '-', 'way_points': [79, 94]}, {'distance': 153.5, 'duration': 18.1, 'type': 1, 'instruction': 'Turn right onto Sterngasse', 'name': 'Sterngasse', 'way_points': [94, 99]}, {'distance': 18.8, 'duration': 6.8, 'type': 12, 'instruction': 'Keep left', 'name': '-', 'way_points': [99, 101]}, {'distance': 2778.7, 'duration': 218.2, 'type': 4, 'instruction': 'Turn slight left', 'name': '-', 'way_points': [101, 126]}, {'distance': 814.4, 'duration': 91.2, 'type': 12, 'instruction': 'Keep left onto Süd Autobahn, A2', 'name': 'Süd Autobahn, A2', 'way_points': [126, 134]}, {'distance': 1857.7, 'duration': 167.8, 'type': 13, 'instruction': 'Keep right', 'name': '-', 'way_points': [134, 163]}, {'distance': 776.5, 'duration': 106.8, 'type': 13, 'instruction': 'Keep right', 'name': '-', 'way_points': [163, 184]}, {'distance': 11.1, 'duration': 4.0, 'type': 2, 'instruction': 'Turn sharp left onto B12a', 'name': 'B12a', 'way_points': [184, 185]}, {'distance': 351.4, 'duration': 55.2, 'type': 4, 'instruction': 'Turn slight left onto B12a', 'name': 'B12a', 'way_points': [185, 195]}, {'distance': 1171.3, 'duration': 113.3, 'type': 12, 'instruction': 'Keep left', 'name': '-', 'way_points': [195, 227]}, {'distance': 47.0, 'duration': 8.5, 'type': 13, 'instruction': 'Keep right', 'name': '-', 'way_points': [227, 228]}, {'distance': 12.2, 'duration': 8.8, 'type': 1, 'instruction': 'Turn right', 'name': '-', 'way_points': [228, 229]}, {'distance': 5.1, 'duration': 1.2, 'type': 0, 'instruction': 'Turn left', 'name': '-', 'way_points': [229, 230]}, {'distance': 0.0, 'duration': 0.0, 'type': 10, 'instruction': 'Arrive at your destination, on the left', 'name': '-', 'way_points': [230, 230]}]
  </code></pre>
  <p>from that output I want to create an excel file looking like that:</p>
  <p><a href="https://i.stack.imgur.com/n1Ww0.png" rel="nofollow noreferrer">excel table</a></p>
  <p>What I've been doing so far was to add the following in two seperate scripts:</p>
  <pre><code>df = pd.DataFrame(data=None, columns =['distance', 'duration', 'type', 'instruction', 'name', 'way_points', 'exit_number'])
  
  
      steps = data['features'][0]['properties']['segments'][0]['steps']
      
      df = df.append(steps, ignore_index=True)
      
  
  book = load_workbook('c:\data\Waypoints.xlsx')
  
  writer = pd.ExcelWriter('c:\data\Waypoints.xlsx', engine = 'openpyxl')
  
  writer.book = book
  
  df.to_excel(writer, sheet_name='name', index=False)
  
  writer.save()
  
  writer.close()
  </code></pre>
  <p>and:</p>
  <pre><code>joinedlist = []
  
       values = data['features'][0]['properties']['extras']['waycategory']['values']
  
       joinedlist = joinedlist + values
  
  df = pd.DataFrame(joinedlist)
      
  book = load_workbook('c:\data\Waycategories.xlsx')
  
  writer = pd.ExcelWriter('c:\data\Waycategories.xlsx', engine = 'openpyxl')
  
  writer.book = book
  
  df.to_excel(writer, sheet_name='name', index=False)
  
  writer.save()
  
  writer.close()
  </code></pre>
  <p>Which unfortunately creates two different tablesizes looking like that:</p>
  <p><a href="https://i.stack.imgur.com/p1Ims.png" rel="nofollow noreferrer">two tables with different sizes</a></p>
  <p>Can anybody hint me the direction I am going wrong to receive the output I am looking for?</p>
  <p>Thanks for your help - any hint is much appreciated!</p>