Welcome to the Forum.
Please take a look at this post:
We need to see the work you’ve done so far and where you’re having trouble. Writing to Excel, getting parameter values, and sorting/grouping data have all been covered many, many times before. There should be plenty of posts to help get you started.