In 1839, while experimenting with an electrolytic cell made up of two metal electrodes, a French experimental physicist named Edmund Becquerel, only nineteen years old at the time, discovered that when exposing certain materials to sunlight he could generate a weak electrical current. He named this phenomenon the \"photovoltaic effect\". The photovoltaic effect is the basic process in which a solar cell converts sunlight into electricity.
Composed of tiny particles of electromagnetic energy, photons are the stuff of light. When photons are absorbed by a photovoltaic cell, which contains a semiconducting material such as silicon or platinum, the energy from the photon is transfered to an electron in an atom of the \"solar cell\". The energized electron is then able to escape its bond with the atom and generates an electric current. This leaves behind a \"hole\". Combined with a P-N junction, which is a layer within the photovoltaic cell that is formed by the intimate contact of P-type and N-type semiconductors that create an electric field, holes move in the opposite direction from electrons, thereby producing an electric current.
This is a simple explanation of the photovoltaic effect. You can learn more about the photovoltaic effect by conducting a Google search.