Isn't there a way to have an emitter emit light only on certain objects?

Imagine I have a plane with two boxes with a spotlight above it.
Scenario 1: simply telling the spotlight to not include one of the two boxes.
Scenario 2: simply telling the spotlight only include one of the two boxes.
greets!