In this article, we investigate the joint task assignment and power control problems for Device-to-Device (D2D) offloading communications with energy harvesting. Exploiting the D2D links for data offloading allows reducing the traffic load of the cellular base stations. The energy consumed by the D2D transmitters for data offloading can be compensated by energy harvesting. The main objective is to maximize the energy efficiency (EE) under energy causality and delay constraints, assuming a harvest–transmit model. Hence, the proposed model results in a nonconvex problem. We first derive an equivalent and more tractable optimization problem by exploiting nonlinear fractional programming, also known as the Dinkelbach method. We propose a layered optimization method by decoupling the EE maximization problem into power allocation and offloading assignment. The first step consists of computing the optimal power values by applying the conjugate gradient method. In the second step, the problem of the D2D pair formation for data offloading amounts to the bipartite graph matching. It can be solved to optimality using the Hungarian algorithm. Extensive simulations were performed on various network scenarios. Numerical results show that the proposed resource allocation scheme achieves remarkable improvements in terms of network EE.