Localized electron heating and current drive, like those produced by electron cyclotron heating (ECH) systems, are powerful tools for controlling the sawtooth period. They allow the direct modification of the plasma parameters which determine the sawtooth stability. In this paper we report a set of new experimental results obtained in the TokamakConfiguration Variable (TCV) and a set of related simulations obtained applying a sawtooth period model in a transport code. The TCV device, equipped with a very flexible and powerful ECH system, is specifically suited for this kind of study. In previous works, the experimental behaviour observed in TCV and JET was found consistent with a sawtooth period model first proposed to predict the sawtooth period in burning plasmas. In this paper, new experimental results have motivated a set of simulations which allow the identification of the effects of localized heating and current drive separately. In particular, two heating locations exist at opposite sides of the q = 1 surface which allow most efficiently sawtooth stabilization and destabilization. Moreover, the modelling shows that counter- and co-current drive alone, without the presence of heating, have opposite effects on the sawtooth period at symmetrical locations as compared with the position of the q = I surface. The main features of the experimental behaviour can be explained as due to the modification of the local plasma parameters involved in the linear resistive stability threshold of the internal kink, in particular the dynamics of the magnetic shear at the q = 1 surface. However it is shown that the most effective locations to modify the sawtooth period are not exactly at q = 1.