Exporting reports to an existing excel template with PHP

Some month ago I had the task to implement a reporting for learning activities. One requirement was an export into an existing Excel worksheet, having prepared pivot tables and charts. My first intention was to look for existing solutions and I tried to build it using PHPExcel. Unfortunately the library is converting input files in an internal format which is not capable of holding charts and pivot tables. Since i didn’t find any other tool to reach my goal, I started to implement my own solution, which i published as open source:

svrnm/exceldatatables

Briefly, exceldatatables takes an existing excel file as template and only overwrites the last worksheet with your report data. Therefor any pivot table or chart is untouched and loading the result file with Excel updates these summaries.

So if you are looking for an easy way to write reports into an excel file, try this library and if you have any issues, tell me!

5 Comments

  1. Javier Fernandez

    Hi mate I’ve been looking up for a lib to do this kind of work i have one question Could I select the start row to write the doc?

    Reply
  2. Severin Neumann (Post author)

    Hi Javier. I’m not sure if I understand your question correctly. Can you give me an example?

    Reply
  3. Mohit

    Can i remove and rewrite already existing template.

    Reply
    1. Mohit

      Actually i have a excelsheet template. In one sheet i am having pivot table and in second sheet am having the data. Now i want i delete all data from the sheet and re write data and pivot table will be refreshed according this data.

      Reply
      1. Severin Neumann (Post author)

        That’s actually the purpose of this tool. The data sheet will be replaced and when you open the result with Excel your pivot table should update accordingly

        Reply

Leave a Comment

Your email address will not be published. Required fields are marked *