Separation of variables on a rectangle
$$ \begin{align*} \begin{cases} \phi_{xx} + \phi_{yy} = 0, &(x,y)\in(0,1)\times(0,1), \\ \phi=0, &x=0,\ x=1,\ y=0, \\ \phi = f, &y=1 \end{cases} \end{align*} $$
can be solved using separation of variables to get, for each $n=1,2,3,\ldots$, $$ \begin{align*} \phi(x,y) &= \sum_{n=1}^{\infty} A_n \sin(n\pi x) \sinh(n\pi y) \end{align*} $$ where $$ \begin{align*} A_n = \frac{2}{\sinh(n\pi)}\int_{0}^{1} f(x)\sin(n\pi x) \d x. \end{align*} $$