Here are some ways you can say "I had a great time" in a formal way:
"I thoroughly enjoyed our meeting/discussion."
"It was a pleasure working with you today."
"I found our conversation very engaging and productive."
"It was a pleasure collaborating with you."
"I sincerely enjoyed our time spent discussing [topic]."
Questions? Do not hesitate to reach out :)