Generar Excel con PHP

Hola a todos, tengo unas clasificaciones mostradas en la web con PHP y quisiera poder descargar la tabla creada en un archivo Excel.

He encontrado este tutorial por la red

http://blog.unijimpe.net/generar-excel-con-php

Pero aunque sigo las indicaciones, no me termina de salir, y es porque me falta excel.php pero no termino de entender que contiene.

Según lo que aparece ahí, en index.php tengo esto:

<?php 

require_once("excel.php"); 
require_once("excel-ext.php");
$assoc = array( 
            array("Nombre"=>"Mattias", "IQ"=>250), 
            array("Nombre"=>"Tony", "IQ"=>100), 
            array("Nombre"=>"Peter", "IQ"=>100), 
            array("Nombre"=>"Edvard", "IQ"=>100)
         );
createExcel("excel-array.xls", $assoc);
exit;
		
?>


Y en excel-ext.php tengo esto:

<?php
function createExcel($filename, $arrydata) {
	$excelfile = "xlsfile://tmp/".$filename;  
	$fp = fopen($excelfile, "wb");  
	if (!is_resource($fp)) {  
		die("Error al crear $excelfile");  
	}  
	fwrite($fp, serialize($arrydata));  
	fclose($fp);
	header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");  
	header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");  
	header ("Cache-Control: no-cache, must-revalidate");  
	header ("Pragma: no-cache");  
	header ("Content-type: application/x-msexcel");  
	header ("Content-Disposition: attachment; filename=\"" . $filename . "\"" );
	readfile($excelfile);  
}
?>

El archivo excel.php lo obtengo de la misma pagina que comento. Viene para descargar y es solo copiar y pegar.

El problema es que me da este error, y según el tutorial, deberia estar todo correcto porque te dan el codigo para que lo copies y lo pegues, sin tener que hacer nada mas

Warning: Cannot modify header information - headers already sent by (output started at /home/bicheand/public_html/index.php:13) in /home/bicheand/public_html/excel-ext.php on line 10

Warning: Cannot modify header information - headers already sent by (output started at /home/bicheand/public_html/index.php:13) in /home/bicheand/public_html/excel-ext.php on line 11

Warning: Cannot modify header information - headers already sent by (output started at /home/bicheand/public_html/index.php:13) in /home/bicheand/public_html/excel-ext.php on line 12

Warning: Cannot modify header information - headers already sent by (output started at /home/bicheand/public_html/index.php:13) in /home/bicheand/public_html/excel-ext.php on line 13

Warning: Cannot modify header information - headers already sent by (output started at /home/bicheand/public_html/index.php:13) in /home/bicheand/public_html/excel-ext.php on line 14

Warning: Cannot modify header information - headers already sent by (output started at /home/bicheand/public_html/index.php:13) in /home/bicheand/public_html/excel-ext.php on line 15
Añado que ya he conseguido obtener un archivo excel, de una forma tan simple como incluyendo este código al inicio del archivo de donde se van a tomar los datos

header("Content-Type: application/vnd.ms-excel");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

header("content-disposition: attachment;filename=Clasificaciones.xls");

Pese a todo, no he sido capaz de solucionar el problema de los errores, lo digo por si alguien quiere ayudarme a solucionarlo, aunque ya sea por aprender más cosas, que siempre viene bien.