Convert encoding from ISO 8859-1 to UTF-8 in PHP project

I have an old PHP project written in PHP 5.2, and am updating it to PHP 8.2

It extracts data from a SQL Server database, and on specific button presses it fills out this data into existing Excel templates.

Since PHPExcel does not exist any more I have used composer to replace it with phpspreadsheet across my project. The project is using UTF-8 for encoding (Header and meta included in my PHP and HTML), and also when connecting to the database.

PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::SQLSRV_ATTR_ENCODING => PDO::SQLSRV_ENCODING_UTF8

I have also changed the default charset = UTF-8 in my php.ini file

On my webpage all the German umlauts are showing without any problem, but the Excel files are not being filled out properly. It seems there is an encoding mismatch somewhere. In my Excel file the word Prüfung"shows like this: prüfung

The collation of my SQL Server database is Latin1_General_CI_AS.

Any ideas? I am expecting the German umlaut characters to be displayed and printed correctly.