Recently, massive intelligent applications have emerged for the smart grid (SG), such as inspection and sensing. To support these applications, there have been high requirements on wireless communication for the SG, especially in remote areas. To tackle these challenges, a UAV-assisted heterogeneous wireless network is proposed in this paper for the SG, where multiple UAVs and a macro base station collaboratively provide a wide range of communication services. To further improve the communication capacity of this system, a joint user association and resource allocation algorithm is developed to maximize the total system throughput. To solve this problem, a matching algorithm is first proposed to solve the user association and subchannel assignment optimization problem. Then, the Lagrangian dual method is utilized to solve the power allocation problem. Finally, extensive simulations show that the proposed algorithm can effectively increase the user communication rate and enhance the capacity of the heterogeneous network for the SG.