Excellency was an honorary title given to high-ranking officers of state or church.
Soval referred to Administrator V'Las with this title after Soval was terminated from his position as a Vulcan Ambassador. Trip Tucker also referred to V'Las by this title. (ENT: "Awakening")
Chairman Eneg was referred to as "your excellency" by one of his SS majors. (TOS: "Patterns of Force")
James T. Kirk referred to Parmen as "your excellency," but Parmen wished to be called by his given name, stating "Philosopher kings have no need of titles." (TOS: "Plato's Stepchildren")
Spock referred to Hodin by the title of "your excellency" during his communiques with the ambassador. (TOS: "The Mark of Gideon")
Clark Terrell, while under the influence of the Ceti eel, referred to Khan Noonien Singh as "his excellency." (Star Trek II: The Wrath of Khan)