PHPExcel in Drupal 7
The data table shold look like this:

 $data = array
    (
        array("Volvo",22,18),
        array("BMW",15,13),
        array("Saab",5,2),
        array("Land Rover",17,15)
    );


And whole working example will look like this:

function hoook_export_excel() {
    module_load_include('inc', 'phpexcel');
    $data = array();
    $headers = array();
    // First worksheet
    // Get the nodes
    $data = array
    (
        array("Volvo",22,18),
        array("BMW",15,13),
        array("Saab",5,2),
        array("Land Rover",17,15)
    );

    $headers = array("CAR","COUNT1","COUNT2");

    // Store the file in sites/default/files
    $dir = file_stream_wrapper_get_instance_by_uri('public://')-&gt;realpath();
    $filename = 'export1.xls';
    $path = "$dir/$filename";
    // Use the .xls format
    $options = array('format' =&gt; 'xls');
    $result = phpexcel_export($headers, $data, $path, $options);
    if ($result == PHPEXCEL_SUCCESS) {
        drupal_set_message(t("Ok"));
    }
    else {
        drupal_set_message(t("Error"), 'error');
    }
}


This will return Excel: