There exists a problem of user privacy leakage in the smart grids (SGs) that malicious attackers may intercept or tamper with electricity data and associate the stolen data with real users to commit crimes. Besides, node equipment resources in the SGs are limited. Aiming at the problems above, most of the existing privacy-preserving schemes apply aggregate signature to ensure the integrity of message and improve communication efficiency. However, they cannot realize the anonymity of users to block link attacks, and their aggregate signature verification usually has a high computational cost. Therefore, we propose a certificateless aggregate ring signature (CLARS) scheme based on computational Diffie-Hellman problem and decisional Diffie-Hellman problem. Our scheme is suitable for privacy-preserving in SGs. In this scheme, certificateless cryptosystem is used to avoid key escrow and certificates management problems and ring signature is used to ensure the unconditional anonymity of users. In addition, our scheme is proved to be unforgeability and unconditional anonymity under adaptively chosen message attacks against Type I and Type II adversaries in the random oracle model. Compared with previous certificateless aggregate signature schemes, our CLARS scheme has lower computational cost, which only needs two pairing operations.