The Swiss envoy, Livia Leu, added that her embassy also tried but were not allowed to the trial of Joshua Fattal and Shane Bauer, who were released last week from an Iranian prison.
"We tried very hard to be admitted to the trial, but we were not," Leu told The Associated Press in an interview conducted by telephone and email.
Leu said Iranian authorities permitted her four 45-minute consular visits, and Iranian officials were always present.
After pressure from her embassy, the two men were able to move into the same cell, something that helped stave off what Leu described as the most difficult part of their incarceration: loneliness.
Fattal and Bauer were detained for more than two years. A third hiker, Sarah Shourd, was released a year ago.
Switzerland has represented U.S. diplomatic interests in Iran since the two countries broke off ties following the 1979 Islamic Revolution.
The Associated Press contributed to this report.