In 1783 and 1784 he attended classes at the Real Jardín Botánico de Madrid, in a program to impart scientific knowledge to pharmacists. In a letter dated December 17, 1784, Cuéllar wrote to Cristóbal Nieto de Piña, vice president of the Royal Medical Society of Seville, that he was compiling a herbarium based on the system of Carl Linnaeus and asking for Nieto's recommendation to fill the vacant position of botanist in Seville. The Royal Medical Society of Seville gave him the appointment on May 2, 1785, but he was unable to accept immediately because he had also been named royal commissioner in Cádiz.