Spectroscopy of molecular ions in Coulomb crystals