Thanks for your post! You can use the get_runs API method to get a list of runs and their details, however this wouldn't be converted into Excel or any other format as you would need to process this with client-side once you've retrieved the data. We would just recommend using the built-in export feature in TestRail to export via Excel as this would be the easiest option:
This can be used in test runs, test plans, milestones, and your test case repository as well. Hope this helps!