As a general rule, the question word which is used when talking about a specific group of things.
For example, if I have four shirts and can’t decide which one I should wear for the important meeting I have later on today, I can ask my husband Which shirt do you think I should put on?
Or if I ask my friend Which film would you like to see?, I’m referring to a couple of films only, not all the films that have ever been made. I just want her to choose from DVDs I have, or the films that are on at the cinema.
On the other hand, if I’d like to ask more general questions, the question word what should be used:
- What clothes do you like wearing?
- What films do you like watching?
The same logic applies to the questions starting with In which year and In what year?
If it’s only a few, specific years we can choose from, use which:
- In which year did the Beatles break up? Was it in 1970 or 1971?
If you would like to choose from a more general range, use what:
- In what year did Napoleon invade Spain?
For most people, this is a general question, as they have no idea when Napoleon came to power.
To learn more about forming questions, read How to Form Questions in English?