Data center, as an important infrastructure of cloud computing, is experiencing rapid growth in both quantity and scale, which causes the high energy consumption and severe environmental problems restricting the development of data centers. Task scheduling can significantly improve the energy efficiency in cloud computing and alleviate the constrain of the high stress on environment. But efficient task scheduling in heterogeneous cloud environment is rather challenging because of the dynamic and complicated environment of data centers. In this paper, we propose a new meta-heuristic task scheduling algorithm called WACOA combining the whale optimization algorithm with the ant colony algorithm, which uses pheromones to collect part excellent solutions from historical information to schedule tasks. Experiments show that WACOA is superior to the whale optimization algorithm and ant colony algorithm. WACOA can reduce energy consumption and improve the performance on task scheduling.