Using PHPExcel 1.7.8 I have a 2007 xlsx Excel File, consisting of a Pie Chart on Sheet1 and two columns of simple data in Sheet2.
The Workbook has a named range defined for both columns in Sheet2, one for labels, the other for data. The pie chart in Sheet1 then references these named ranges meaning it will auto update as data is added/removed from Sheet2.
Using PHPExcel I can read the sheet, edit data in Sheet2 and write back to Excel 2007. However, using the setup noted above, where a chart uses named ranges, PHPExcel throws the error Invalid cell coordinate CHARTDATA when reading the Excel, having looked further it seems PHPExcel doesnt read any prexisting named ranges but loses them, though these can then be defined again via code- the error still persists.
Crucially what Im after is using PHPExcel to load a spreadhseet which has a graph in it, edit the underlying data -adding or removing rows, and then write back to Excel with the graph updating accordingly.
Many thanks for any help!
Full error below:
Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'Invalid cell coordinate CHARTDATA' in /home/content/34/6122134/html/core.excel/Classes/PHPExcel/Cell.php:539
Stack trace:
#0 /home/content/34/6122134/html/core.excel/Classes/PHPExcel/Cell.php(674): PHPExcel_Cell::coordinateFromString('CHARTDATA')
#1 /home/content/34/6122134/html/core.excel/Classes/PHPExcel/Cell.php(693): PHPExcel_Cell::rangeBoundaries('ChartData')
#2 /home/content/34/6122134/html/core.excel/Classes/PHPExcel/Chart/DataSeriesValues.php(298): PHPExcel_Cell::rangeDimension('ChartData')
#3 /home/content/34/6122134/html/core.excel/Classes/PHPExcel/Chart/DataSeries.php(350): PHPExcel_Chart_DataSeriesValues->refresh(Object(PHPExcel_Worksheet), false)
#4 /home/content/34/6122134/html/core.excel/Classes/PHPExcel/Chart/PlotArea.php(121): PHPExcel_Chart_DataSeries->refresh(Object(PHPExcel_Worksheet))
#5 /home/content/34/6122134/html/core.excel/Classes/PHPExcel/Chart.php(499): PHPExcel_Chart_PlotArea->refresh(Object(PHPExcel_Worksheet))
#6 /home/conten in /home/content/34/6122134/html/core.excel/Classes/PHPExcel/Cell.php on line 539