Read and write xlsm in php

Hello everyone,

For many days I’ve tried to read entire xlsm file (4MB) with phpexcel but no success.
My file have images and macros.

I could read the file but the new file have no images and no macros.
With this code, he shows me the same error (“Out of memory tried to allocate…”) when i use this code:

        $inputFileName = "teste1.xlsm";
        $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
        $objReader = PHPExcel_IOFactory::createReader($inputFileType);
        $objReader->setLoadAllSheets();
        $objPHPExcel = $objReader->load($inputFileName);
        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
        $objWriter->save('testing1.xlsm');

My php.ini from my server have:
-memory_limit: 512M.

Anyone have tried to read this file or I need to read this file in other language?

Thank you

judging from the PHPExcel docs, .xlsm files are not (fully) supported so it might drop functionality present in the original file.

There’s other way to read and write this kind of file?

I would assume not (at least not with PHP).

Hi everyone,

I could read the excel file in java.
My intention now is the user call java code from my laravel website and the java send to my website a download of the excel file.
What’s the best way to connect php to java and vice versa.
I’m using linux server.

Thank you

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.