Not sure how to do it, I put a question up on stack overflow. I only got one answer, but it was the right answer, and I'm able to make PHPExcel write the contents of an excel file directly into a variable:
$writer = PHPExcel_IOFactory::createWriter($phpExcelObj, 'Excel2007'); ob_start(); $writer->save('php://output'); $excelOutput = ob_get_clean();
However, the guy that replied also made a snooty remark about how I was perhaps an idiot for not writing to disk first. I wrote a response saying that, while I appreciated his insights into my intellect, my question was how to do something, not his by-the-gospel opinion on whether or not I should follow the PHPExcel playbook.
Just before sending it, however, I started to wonder why he would say something like that, and whether or not he was just some crank trolling StackOverflow, so I checked out his profile.
Turns out he's one of the actual authors of PHPExcel. And rather well respected. I have 49 reputation points on Stack Overflow. He has 36,000. His opinion carries a bit more weight, I should think.
I sent him a note thanking him for his input, and then I voted him up.