Suppose I have $f_{xx}+f_{yy}=0$ on a region $R=\{(x,y):0\leq x\leq\alpha,0\leq y\leq\beta\}$ with boundary conditions $f(0,y)=f(\alpha,y)=0$, $f(x,0)=g(x)$, and $f(x,\beta)=h(x)$. I considered a solution using the standard separation of PDEs:
$$f(x,y)=X(x)Y(y)$$ $$\frac{X''}{X}=\frac{Y''}{-Y}=-\lambda$$ $$Y(y)=k_1\cosh(\sqrt\lambda y)+k_2\sinh(\sqrt\lambda y)$$
But my solution for $Y(y)$ is always senseless, even if I change the sign on $\lambda$, because of the boundary value conditions. So I then considered trying to solve this as I would a non-homogeneous heat equation, where $f(x,y)=v(x)+w(x,y)$, but since I can't get a nice relation on $v_{xx}$ here given that it is not a steady-state, this approach gets me nothing.
What should I try now?
Your first approach is right. Separated solutions will be $X_n(x)Y_n(y)$ where $$X_n(x)=\sin \frac{\pi n}{\alpha}x,$$ from the homogeneous boundary conditions. Accordingly, $$Y_n(y)=A_n\cosh \frac{\pi n}{\alpha}y+B_n\sinh \frac{\pi n}{\alpha}y$$ It remains to make sure that $\sum X_n(x)Y_n(0)=g(x)$ and $\sum X_n(x)Y_n(\pi)=h(x)$. Begin with the first one: the equation $$ \sum_{n=1}^\infty A_n\sin \frac{\pi n}{\alpha}x = g(x) $$ determines all $A_n$ coefficients. Then, from $$ \sum_{n=1}^\infty \left(A_n\cosh \frac{\pi n \beta}{\alpha}+B_n\sinh \frac{\pi n \beta}{\alpha}\right) \sin \frac{\pi n}{\alpha}x = h(x) $$ you determine $B_n$ coefficients.