title: database export to excel file using codeigniter
body: <p>Here I show some partial code for database table export my excel file. The file is written but not right formatted:</p>
  
  <pre><code>function get_report(){
      $this-&gt;load-&gt;dbutil();
      $this-&gt;load-&gt;helper('download');
      $query = $this-&gt;pharmacy_model-&gt;get_report();
      $data = $this-&gt;dbutil-&gt;csv_from_result($query, ';');
      force_download('CSV_Report.csv', $data);
  }
  </code></pre>
  
  <p>It is downloaded and extracted with data, but format is not right. I need it like in <a href="https://i.stack.imgur.com/nu4tP.jpg" rel="nofollow noreferrer">this image</a></p>