It is known that sunlight has all the visible lights and cosmic rays (probably gamma rays), but what about the other wavelengths? If they are available, can one filter it and use it for spectroscopy?
The sun, as any star, is a black body radiator. Its spectral distribution will depend on its temperature. Most of the Sun's electromagnetic radiation is absorbed by Earth's atmosphere. In other words, the atmosphere acts as a light filter only allowing the wavelengths of 350 to 760 nm to reach the Earth's surface.
Please check out the websites listed below. Satellites well above the Earth's atmosphere are able to study the Sun over a much broader range of wavelengths than can be studied by Earth-based observatories.
Even though you get a desired range of wavelength by filtering the sun radiation, the intensity of your source light in your spectrometer will be too weak to study the materials.