PHPExcel clone.xlsm with macros

I try to read, clone and write and the .xlsm file using PHPExcel, but I get the error message: Fatal error: throw an exception "Exception" with the message "Worksheet!" G177 β†’ Formula Error: An unexpected error occurred in ...

Does anyone know how I can read, clone and write an Excel file using macros, I mean that the macros are in the template (the file I am reading). I just want to clone this file and write on it, and just save the macros in a new file. Is this possible with PHPExcel? is there any other library for this?

Thanks.

+5
source share
3 answers

First:

  • PHPExcel does not support reading Excel macro files (.xlsm).

Secondly:

  • It does not support macros.

And I don’t know about any PHP libraries that support this.

The only way I know for sure that you could do this is to use the PHP PHP extension on a server with MS Excel installed.

The only alternative to COM that can work is the extension of Ilya Alshanetsky to Excel.

+6
source

This thread is a bit old, but I had the same problem when I needed to modify Excel files using macros from PHP. No PHP librairy, which I know, supports editing Excel files without adversely affecting macros.

However, the LibXL library supports saving macros from version 3.3.1. It is not written in PHP, but what we ended up with is writing our Excel editing in C ++, and we called this C ++ program from PHP using the exec () method. It worked very well and had very good performance. Hope this helps someone.

+4
source

I have to do something like this. I am using PHPSreadsheet and my code is hosted on a Debian 9 server.

I know this thread is old, but I'm looking to find something similar ... So, do you know if today there is a PHP library that can write over Excel with a macro (and Macro can still be used after)

Thank you very much.

0
source

Source: https://habr.com/ru/post/950075/


All Articles