Remove the header lines in script. The browser display the file (you get some "garbage" of course).
It's not easy with all comment lines, but playing with your script, i got a valid xlsx with a graph... I think i have change somewhere "$objWorksheet->fromArray($valpass" in "$objWorksheet->fromArray(", a few 98 to 9 and ZZ98 to T30 (i don't have a 100" monitor).
It's not easy with all comment lines, but playing with your script, i got a valid xlsx with a graph... I think i have change somewhere "$objWorksheet->fromArray($valpass" in "$objWorksheet->fromArray(", a few 98 to 9 and ZZ98 to T30 (i don't have a 100" monitor).