We prove a transformation formula for the function for the exponential sum involving the divisor function. This formula can be applied to obtain meromorphic continuation for the Mellin transform of the square of Dirichlet L-function with principal character.