0

I have to code a php script which will write some values in a spreadsheet. PhpSpreadsheet will be used for this work.

First, is it possible to write in a existing file without overwritting the existing strings and formulas? ==> I guess yes by using IOFactory

Some cells should be a list based on a specific area. I mean exactly the same as using "Data validation" in Excel? Is it possible to do that? And how? I havent't read anything about that...

Thanks for your help. Regards,

Clement
  • 13
  • 3
  • Look into the fputcsv() function (http://php.net/manual/en/function.fputcsv.php). the fopen accepts a parameter `a+` which stops the values being overwritten everytime the file is opened. – Ibrahim Hafiji Apr 19 '18 at 10:27
  • If you set a value for a cell that already has content, then it will overwrite that existing content.... it's up to your code to append a value to a cell – Mark Baker Apr 19 '18 at 12:09
  • And the [PHPSpreadsheet documentation](https://phpspreadsheet.readthedocs.io/en/develop/topics/recipes/#setting-data-validation-on-a-cell) has a section on setting data validation on a cell – Mark Baker Apr 19 '18 at 12:12
  • Indeed, I read too fast. Anyone knows how to set the index of the list? I mean, ok, I have created the list with the range technique but then how can specify to begin the list on a specific value. Let's say I have Element1, Element2, Element3 in the list. How should I do to show Element2 when the file is openend instead of a blank cell ? – Clement Apr 19 '18 at 15:06

0 Answers0