# Embed an Excel spreadsheet inside a PDF?

Is it possible to include an .XLS file inside a PDF, so that the user could open/extract the spreadsheet from their PDF viewer? (Maybe in the same manner MS Word allows you to include a DDE object?) It would not need to show any spreadsheet content or anything fancy like that; I am just looking for a way to have the spreadsheet included with the PDF file.

If so, what tools would I need to do it?

-
Do you mean displaying a link or icon in the pdf which, when activated, will open an Excel spreadsheet? –  music2myear May 23 '11 at 20:08
@music2myear Sort of... I'm thinking of publishing an ebook and want to include a spreadsheet (with macros) as part of the purchase. Rather than going through a huge fuss with the publisher about having unique download codes for each customer or something like that, I'd prefer to have the file included in the PDF that people buy. (Then again, if I want the book enabled on Kindle or such, then maybe I need to do the external download anyway...) –  ewall May 24 '11 at 14:01

This may be a start until it becomes more clear what it is you are asking. Acrobat 8 (and thus, subsequent versions) include the ability to package files of different types within a pdf file: http://help.adobe.com/en_US/Reader/8.0/help.html?content=WSE034CA46-D08F-4fff-AA3C-FF04510DAEF0.html

UPDATED in response to comment: I did a google search for "create pdf packages" and there appear to be several applications that cost less than Acrobat that offer this capability. I could not find an open source or free option to do this, though. Ghostscript tries to be a pretty full-featured system for creating PDFs and with more research I believe it's the best place to look for open source creation of PDF packages.

-
Excellent... that is the feature I'm looking for. Do you know if any PDF software other than the full Acrobat Suite can make packages? –  ewall May 24 '11 at 13:58

The Free (as in liberty) and free (as in beer) commandline utility pdftk is available for all major OS platforms (Unix, Linux, Windows, Mac OS X). It has a sub-command to embed external files into a PDF. Try this:

 pdftk.exe ^
original.pdf ^
attach_files file1.docx file2.xls file3.html ^
to_page 3 ^
output file-with-attachments.pdf


The attached files will be indicated to belong to page 3 of the output PDF. To de-tach the files embedded in a PDF, try this:

pdftk.exe ^
file-with-attachments.pdf ^
unpack_files ^
output c:\path\to\directory\


All attachments will then be stored in the named output directory.

-
Y'know, I think I've used pdftk before to fix corrupted PDFs. (BTW, I accepted @music2myear's answer but gave you some points as well for answering the second part of the question.) –  ewall May 25 '11 at 16:40