Hi Johannes, welcome
Please take the time to review How to get help on the Dynamo forums
Your code is in part unformatted, requires pyrevit
which may not necessarily be available to Dynamo and the Excel interop which does not operate with current .NET frameworks
My code responded and reasonably solved the original post, it would be trivial to use OOTB nodes to save the list of filenames to an Excel file
This post is also a year old, so before responding, please ask if you are actually contributing to the topicโs conversation