Thermal-aware (TA) task allocation is one of the most effective software-based dynamic thermal management techniques to minimize energy consumption in data centers (DCs). Compared to its counterparts, TA scheduling attains significant gains in energy consumption. However, the existing literature overlooks the heterogeneity of computing elements in terms of thermal constraints while allocating or migrating user jobs, which may significantly affect the reliability of racks and all the equipment therein. Moreover, the workload distribution among these racks/servers is not fair and efficient in terms of thermal footprints; it is potentially beneficial to determine the workload proportion for each computing node (rack/server) based on its marginal contribution in disturbing the thermal uniformity (TU) in a DC environment. To solve the said problems, we model the workload distribution in DCs as a coalition formation game with the Shapley Value (SV) solution concept. Also, we devise Shapley Workload (SW), a TA scheduling scheme based on the SV to optimize the TU and minimize the cooling cost of DCs. Specifically, the scheduling decisions are based on the ambient effect of the neighboring nodes, for the ambient temperature is affected by the following two factors: (1) the current temperature of computing components and (2) the physical organization of computing elements. This results in lower temperature values and better TU, consequently leading to lower cooling costs. Simulation results demonstrate that the proposed strategy greatly reduces the total energy consumption compared to the existing state-of-the-art.