title: Saving data in excel by cell rather than semi-colon with python
body: <p>***Edit: I am originally saving the code to a .csv file but then later converting it to a .xlsx file.</p>
  <p>I am trying to change my code to save the values in separate cells verses in the same cell separated by a semicolon. I currently have code that saves the values (8 values per row) in a single cell separated by a semicolon and then have a separate set of code that I run to do text-to-columns. I am not well versed in Python but I think I should just be able to edit the chunk of code that saves the values to the csv file to do this.</p>
  <p>Here is the chunk of code that saves the data to the excel file.</p>
  <pre><code># Stores data in Excel File
  with open(output, &quot;w&quot;) as fp:
       for line in data:
           fp.write(&quot;; &quot;.join(str(x) for x in line))
           fp.write(&quot;\n&quot;)
  </code></pre>
  <p>Just in case, here is the code that gathers the data and how its stored</p>
  <pre><code>def recordData(memory_service):
      &quot;&quot;&quot; Record the data from ALMemory.
          Returns a matrix of values
      &quot;&quot;&quot;
      print &quot;Recording data ...&quot;
      data = list()
      startTime = time.time()
      s = 9.06
  
      while True:
          currentTime = time.time()
          elapsedTime = currentTime - startTime
          line = list()
  
          for key in ALMEMORY_KEY_NAMES:
              value = memory_service.getData(key)
              line.append(value)
              print value
          data.append(line)
  
          if elapsedTime &gt; s:
              return data
  </code></pre>
  <p>Lastly here is a picture of how the code saves: <a href="https://i.stack.imgur.com/ifmuV.png" rel="nofollow noreferrer">Excel Data</a></p>
  <p>I am using Python 2.7.18 and PyCharm 2022.1.2.</p>
  <p>***Edit: Code that converts .csv to .xlsx</p>
  <pre><code># Reads in the .csv file and converts it to .xlsx
      readFile = pd.read_csv(r'C:\Users\PycharmProjects\FsrValues5.csv')
      readFile.to_excel(r'C:\Users\PycharmProjects\Excel Data\New Trials\FsrValues5.xlsx', index=None,
                        header=True)
  </code></pre>