do I first calculate the headwind component of that wind and use this
yes
taking off from runway 09 and the wind is from 120M (30 degrees to the runway) and the wind is 20 KTS, then the crosswind would be 10 KTS and the headwind would be 17 KTS (approx). Therefore should I use 17KTS as the headwind in the calculations
Minor caveat to keep in mind. While the runway number generally indicates the magnetic direction rounded off to the nearer 10 degrees, this may not always be the case, for example, if the number is modified to avoid confusion with multiple runways. It is preferable to check the runway magnetic direction (eg AIP) and work from that figure rather than the rounded runway number. Generally, not a significant difference, but it is an easy consideration to address.
A couple of other considerations.
With a crosswind, there will be an increase in drag although this, generally, will not create a significant difference in the distance requirement.
However, a much more important consideration, if you are flying multi-engined aircraft, relates to Vmcg, if you are operating in that low-speed range for the takeoff. The real world Vmcg (as opposed to the certification figure) changes markedly in a strong crosswind. If the failure is on the upwind engine, the real world Vmcg will increase and, if on the downwind engine, decrease. This may invalidate the speed figures for a minimum speed, or near minimum speed, takeoff even to the extent that the aircraft may depart the side of the runway unless the takeoff is rejected. Certainly, worth keeping in mind for those folks who end up on heavy aircraft.