In December 1760 he bought a pharmacy on Atocha Street in Madrid, and entered the Royal College of Pharmacists. After completing the course, he continued his association with the College in various important capacities — first secretary, general solicitor, fiscal, and second secretary, at different times. Around 1781 he was forced to give up his pharmacy for financial reasons.
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 Carolus 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.
On March 10, 1785, King Charles III signed a royal order establishing the Real Compañía de Filipinas (Royal Philippine Company). This was a political-mercantile society intended to turn the Philippines into a hub of trade between Asia and America. (That would have meant the end of the monopoly of the Manila galleon, and was opposed by many Spaniards in the Philippines.) The Company was also intended to investigate and exploit the natural resources of the Philippines themselves.
The Company asked the minister of the Indies, José de Gálvez to name a botanist to investigate the flora of the islands. Gálvez turned over the task to Casimiro Gómez Ortega, head of the Real Jardín Botánico de Madrid. Gómez named Cuéllar.
At the beginning of January 1786 Cuéllar sailed on the Águila Imperial for Manila by way of the Cape of Good Hope. He was accompanied by his second wife, María Borbón. On August 9, 1786, after eight months at sea, the ship arrived at Cavite, in the Philippines.
On-going conflicts forced him to limit his initial explorations to the area around Manila. At first he concentrated on the cultivars in which the Compañía took special interest: indigo, black pepper, cotton, mulberries, coffee and cacao. In March and April he went a little farther afield, to Batán.
From his arrival, Cuéllar began collecting scientific materials to send back to Spain. The first specimens sent back were natural products of the Philippines, including seashells, seeds, resins, woods, drawings, minerals, and some living plants. These date from the beginning of 1787. Cuéllar assiduously continued the shipments until 1797, overcoming some difficulties to do so.
A royal order dated in January 1788 directed him to promote the cultivation of cinnamon and nutmeg, in a last attempt to break the Dutch commercial monopoly on these spices. However the varieties he was able to study were not suitable.
On March 24, 1792, the corvettes Descubierta and Atrevida of the scientific expedition of Alejandro Malaspina arrived in Cavite. Cuéllar met with the expedition, and showed its botanist, Antonio Pineda some of the plantations around Manila. The expedition sailed from Manila on November 15, 1792.
He remained in the Philippines until his death. The governor named him commissioner of public lighting in Manila, and later superintendent of the cloth factories in the province of Iloco, where he was also provincial governor. He died there in late 1801.