3

UPDATE:

Just tested this scenario with PHPExcel 1.7.8 and it is still not working. Pivot tables in sheets that are not actively touched through PHPExcel simply vanish and what is left is the old numbers surrounded by borders.


I have an Excel 2007 workbook with two sheets:

  1. dashboard

  2. data

In 'data' there is just an aggregation of tabular organized data and in 'dashboard' is

  1. a simple chart

  2. and a pivot table based on the data in 'data'.

What I want to do is update the data in the 'data' sheet using PHPExcel. So far no problem. But when I open the workbook again, the chart is gone and the pivot table turned into a simple formatted table.

I am not touching the 'dashboard' sheet at all and tried so far different things to work around that issue, f.x.:

  1. deleting 'data', creating a new 'data' and fill in the figures

  2. PHPExcel::setIncludeCharts(true)

I think this behaviour is weird. Apart from that PHPExcel is working fine.

EDIT:

Another work around I just applied is to store the data in a separate workbook. Then the pivot table within the second workbook is successfully updated. But I would like to store that data in the same workbook as the user interface just on a separate sheet.

Raffael
  • 19,547
  • 15
  • 82
  • 160
  • First... try with the latest github code - it includes a number of fixes to the chart writer: second, pivot tables aren't supported at this point in time – Mark Baker Jul 25 '12 at 21:46
  • @MarkBaker i have chart goes missing too. in the template file i already have the chart formatted correctly. All I want the phpexcel to do is populate the cells.. and my embedded chart object should update with my data. I don't want to create the chart with in the code.. Why should I.. as excel template has already got the chart and formatted to my liking. Each time I run the example code... the chart goes missing from the resulting output file. everything else is ok. Image, formula, text stays intact... but the chart simply disappears. please help. – ihightower Nov 01 '12 at 05:34
  • @MarkBaker you can read my new question on the same in here: http://stackoverflow.com/questions/13171841/phpexcel-using-it-with-excel-template-chart-goes-missing-php – ihightower Nov 01 '12 at 06:14
  • Here's a proper solution: http://stackoverflow.com/questions/25628205/is-it-possible-to-generate-or-clone-pivot-tables-using-phpexcel-library Hint: it uses another library – nawfal Apr 02 '16 at 06:41

2 Answers2

1

phpexcel unfortunately does not currently supported the pivot tables. But I've solved this way:

  • I've created a template excel file, including only pivot tables. But data source as external Data.xlsx file.
  • I've generate Data.xlsx file with PHPExcell.
  • Finally, I've zipped these two files for send report via email. (Or maybe download report)
Ahmet Erkan ÇELİK
  • 2,364
  • 1
  • 26
  • 28
-2

I am not sure about it. check whether the data are passed to the xlsx sheet is in correct format(datatype). Some time the integer values may be passed as text will lead problem in operations.

Following links may help you

http://phpexcel.codeplex.com/workitem/16

http://phpexcel.codeplex.com/wikipage?title=Examples
Suresh kumar
  • 2,002
  • 1
  • 19
  • 28