title: python: excel: print in columns then start in next row
body: <p>I have data from beautifulsoup in the form of: </p>
  
  <pre><code>a
  b
  c
  d
  e
  f
  </code></pre>
  
  <p>I want to get them in excel in the following format:</p>
  
  <pre><code>a b c d e f g 
  h i j k l m n
  o p q r s t u
  etc...
  </code></pre>
  
  <p>when i print them in excel. </p>
  
  <p>This is the code I have currently: </p>
  
  <pre><code>import openpyxl
  from openpyxl import Workbook
  import requests
  from bs4 import BeautifulSoup
  for i in range (1,2):
     url ="https:...."
     response=requests.get(url,verify=False)
     soup=BeautifulSoup(response.text)
     g_data=soup.find_all("td",{"class"})
     results=[]
     for item in g_data:
               data=(item.text)
               results.append(data)
               wb=Workbook()
               ws=wb.active
               for row, i in enumerate(results):
                        columns_cell='A'
                        ws[column_cell+str(row+2)]=str(i)
               wb.save("test.xlsx")
  </code></pre>
  
  <p>Thanks in advance for your help. </p>
  
  <p>UPDATED code:</p>
  
  <pre><code>for i in range (1,3):
  url="https:.... .format(pagenum=i)
  response=requests.get(url)
  soup=BeautifulSoup(response.text)
  g_data=soup.find_all("td","class")
  row=[]
  wb=Workbook()
  ws=wb.active
  for idx, item in enumerate(g_data):
      row.append(item.text)
      if not idx % 7:
          ws.append(row)
          row=[]
  wb.save("test2.xlsx")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qJSJl.jpg" rel="nofollow noreferrer">UPDATED RESULTS PICTURE:</a></p>
  
  <p>Finally this works: </p>
  
  <pre><code>for i in range (1,2)
  url="https:... "
  response=requests.get(url)
  soup=BeautifulSoup(response.text)
  g_data=soup.find_all("td",{"class"})
  results=[]
  for item in g_data:
      results.append(item.text)
  df=pd.DataFrame(np.array(results).reshape(20,7),columns("abcdefg"))
  writer=pd.ExcelWriter('test4.xlsx', engine='xlsxwriter')
  df.to_excel(writer, sheet_name='Sheet1')
  writer.save()
  </code></pre>
  
  <p>The problem with this one is that its overwriting the previous results. Still a bit more work to do. but progress :) </p>