PHPSpreadsheet not getting data from SQL Query?

IMHO, the database needs attention. (eg. ALTER)

But I know some desktop spreadsheet apps have “formulas” and the possibility to add “macros”.

I think there should be some here that could help if you would prefer to start a topic in General Web Dev