Of course that's the reason but not in a direct sense. Solar cells use photovoltaic effect. When photons strike electrons in the valence band of a material, those electrons may gain enough energy to go to the conduction band, where they are free to move. Now they can move toward a junction and go into a different material. The whole thing is subject to a potential difference that causes the electrons to go into the second material and continue moving there and this is how light produces electricity in solar cells.