I'm trying to read, clone and write and .xlsm file with PHPExcel but I get an error: Fatal error: Uncaught exception 'Exception' with message 'Worksheet!G177 -> Formula Error: An unexpected error occured' in...
Anybody know how can I read, clone and write and Excel file with macros, I mean the macros are in a template (the file that I reading) I just want to clone that file and write on it, and just keep the macros in the new file. Is that possible with PHPExcel ? is there another library to do that ?
Thanks .
First:
Second:
And I'm not aware of any PHP libraries that support this.
The only way that I know for certain that you could do this would be using PHPs COM extension, on a server with MS Excel itself installed.
The only alternative to COM that may work would be Ilia Alshanetsky's Excel extension
This thread is a little old, but I had the same issue where I needed to modify Excel files with macros from PHP. No PHP librairy that I know support edit Excel files without negatively impacting the macros.
However the LibXL library supports the preservation of macros as of version 3.3.1. It's not written in PHP, but what we ended up doing is to write our Excel editing in C++ and we called that c++ program from PHP via the exec() method. It worked very well and had very good performance. Hope it helps somebody.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With