使用包含文件打破PHPExcel输出

I use a file to build an array from a database, and I want to write to an excel sheet based on this array.

As such I include the file in the following code

(the code below is a complete copy paste of the code used to read from an excel template, edit the data, and write the file and prompt a download for the user)

/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('Europe/London');

if (PHP_SAPI == 'cli')
    die('This example should only be run from a Web Browser');

/** PHPExcel_IOFactory */
require_once '../Classes/PHPExcel/IOFactory.php';

$objReader = PHPExcel_IOFactory::createReader('Excel5');
$objPHPExcel = $objReader->load("template.xls");

//HERE IS MY INCLUDE FILE
include($_SERVER["DOCUMENT_ROOT"] . "/includes/excelwrite_data.php");   

$objPHPExcel->setActiveSheetIndex(0)
            ->setCellValue('A2', 'TEST')    

// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="01simple.xls"');
header('Cache-Control: max-age=0');

header('Cache-Control: max-age=1');


header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header ('Cache-Control: cache, must-revalidate'); 
header ('Pragma: public');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');

This generates a garbled excel file output, and warnings of corrupted data (similar to what happens when your php results in some echod character that messes it up. I have checked that my included file echoes nothing.

What is bizarre, is if I literally copy paste the contents of the included file into the spot where the include is in the above code, it works perfectly.

Is there something about includes that doesn't play well with PHPExcel?

Many thanks for your thoughts in advance.