Reputation: 95
Hi and thanks for reading.
I have an excel spreadsheet that has files inserted into 1 column, and I'm looking for a way to pull them out with php so that I can then copy them to another directory.
So far I've had a look at PhpExcel and ExcelReader but unless I'm missing something, I cant see anywhere in the respective API's that details how to extract files. I have seen some code for getting hyperlinks and PHPExcel_Worksheet_Drawing and PHPExcel_Worksheet_MemoryDrawing, but nothing for general files.
Does anyone know if this is possible, and if so using what utility class? Or even better, could someone please show me a sample piece of code.
Thanks again for reading, Ian
Upvotes: 1
Views: 858
Reputation: 70379
IF the Excel files are XLSX
(2007 / 2010) then just unzip
them since they are zip files with a folder structure and several XMLs inside... and somewhere in the structure there the embedded files...
the folder inside the Excel file containing embedded files is called xl/embeddings/
IF for some reason you need to handle older formats (XLS
) and/or need some feature in working with Excel files you will need a 3rd-party library... one example is Aspose.Cells for Java which can access/extract/add embedded files (=OLE objects, see http://www.aspose.com/documentation/java-components/aspose.cells-for-java/com/aspose/cells/oleobject.html#getObjectData%28%29) and has a PHP interface, see http://www.aspose.com/documentation/java-components/aspose.cells-for-java/aspose-cells-for-java-php.html
Upvotes: 2