Excel is tricky since there is no open documentation on the file format. Perhaps you could see if Open Office have documentation for how they read excel files (not perfect but good enough for most use cases). You can however use a comma separated string with line feeds ("\n"), where each line contains row data and each comma separated value represents cell data on that row.
PDF documentation is open and can be found someplace at adobe.com, but creating such files is not trivial and modifying them requires a bit more knowledge. I'd recommend either googling for PHP code that deals with writing PDF files or searching this forum for info on the topic.
There are other automated ways to create PDF files outside of your PHP code. One would be using TeX or LaTeX. You could create your TeX/LaTeX code in PHP and also use PHP to execute the TeX/LaTeX parser. And I suppose it would be possible to turn html code into postscript which can be turned into pdfs on *nix platforms.