title: Export Mysql data to a customized XLS file using php
body: <p>First of all, I do know the process of exporting MySQL data to excel file using php. But I have some specific requirement and I want to know if it can be done or not. I have already googled, but didn't get any specific information or method regarding the same.</p>
  
  <p><strong>This is my xls template :</strong></p>
  
  <p><img src="https://i.stack.imgur.com/ZQSCI.png" alt="enter image description here"></p>
  
  <p><strong>Overview:</strong></p>
  
  <p>Column C is fixed and others are scrollable.
  There are basically couple of organizations.</p>
  
  <p>Data starting from COL-C8 to COL-L8 is exactly stored on a MySQL Table of an organization (e.g. Organization1).</p>
  
  <p>Data of COL-C1 to COL-C5 &amp; D1 to D5 is on another MySQL Table of Organization1.</p>
  
  <p>So for every organization there are 2 different MySQL tables.</p>
  
  <p><strong>Requirement :</strong></p>
  
  <p>The goal is to export data from MySQL and add it to the excel file according to the image above.</p>
  
  <p><strong>Problem :</strong></p>
  
  <p>Adding data from MySQL table to excel is pretty easy if the requirement is to just replicate same on the excel sheet. But I have no idea how to do this customization.</p>
  
  <p>Like pulling data from two different tables and adding them to different columns in an excel sheet.</p>
  
  <p>Please let me know if it is possible. And if yes, then kindly direct me to some references on how to achieve this.</p>
  
  <p>Thank You!</p>