how to export an excel in php with columns background coloured?
<p>I am trying to export an excel with the following code -</p>

<pre><code>$data = array(
    array("firstname" =&gt; "Mary", "lastname" =&gt; "Johnson", "age" =&gt; 25),
    array("firstname" =&gt; "Amanda", "lastname" =&gt; "Miller", "age" =&gt; 18),
    array("firstname" =&gt; "James", "lastname" =&gt; "Brown", "age" =&gt; 31),
    array("firstname" =&gt; "Patricia", "lastname" =&gt; "Williams", "age" =&gt; 7),
    array("firstname" =&gt; "Michael", "lastname" =&gt; "Davis", "age" =&gt; 43),
    array("firstname" =&gt; "Sarah", "lastname" =&gt; "Miller", "age" =&gt; 24),
    array("firstname" =&gt; "Patrick", "lastname" =&gt; "Miller", "age" =&gt; 27)
  );

  function cleanData(&amp;$str)
  {
    $str = preg_replace("/\t/", "\\t", $str);
    $str = preg_replace("/\r?\n/", "\\n", $str);
    if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"';
  }

  $filename = "website_data_" . date('Ymd') . ".xls";

  header("Content-Disposition: attachment; filename=\"$filename\"");
  header("Content-Type: application/excel");

   $flag = false;
  foreach($data as $row)
  {
    if(!$flag){

      echo implode("\t", array_keys($row)) . "\r\n";
      $flag = true;
    }
    array_walk($row, __NAMESPACE__ . '\cleanData');
    echo implode("\t", array_values($row)) . "\r\n";
   }

  exit;
</code></pre>

<p>The above code is working fine for exporting excel, but i want the header of the excel to be coloured in any specific colour, but could not found anything to do this.
Please help.</p>