title: Woocommerce order export API separate rows for each item for the same order Python
body: <p>I have the following code in Python. It gets json data from an API from woocommerce and then makes a csv file which i want so i can automate things. My problem is that the csv file that i get has in the same row under one column all the items purchased for the order. What i want is to have 1 row for each item with all the other columns remain the same for each order.</p>
  <pre><code>import requests
  from woocommerce import API
  import pandas as pd
  import json
  import pandas
  import csv
  from pandas.io.json import json_normalize
  import flatten_json
  
  
  
  wcapi = API(
      url=&quot;https://www.fempharm.gr&quot;,
      consumer_key=&quot;****************&quot;,
      consumer_secret=&quot;**************&quot;,
      wp_api=True,
      version=&quot;wc/v3&quot;
  )
  
  
  
  
  data=wcapi.get(&quot;orders&quot;).json()
  
  pandas.json_normalize(data)
  
  with open('data.json', 'w') as f:
      json.dump(data, f)
  
  df=pandas.read_json(&quot;C:\\Users\\John\\OneDrive - ΠΑΛΙΝ\\python projects\\data.json&quot;)
  df.to_csv(r&quot;C:\\Users\\John\\OneDrive - ΠΑΛΙΝ\\python projects\\data.csv&quot;)
  df.to_excel(r&quot;C:\\Users\\John\\OneDrive - ΠΑΛΙΝ\\python projects\\data.xlsx&quot;)
  </code></pre>
  <p>Thank you in advance</p>