Using a utility knife, score the caulk around the outside of the window frame. Then do the same inside of the trim. With the seal broken, use a pry bar to remove the exterior trim -- take extra care, as you will reuse this trim after the windowsill is installed.
Cut out the window using a reciprocating saw with a fine-tooth blade. Have someone hold the window so it doesn't fall and break. To remove the framing member, again use the reciprocating saw, which should cut right through the nails.
If only the top of the sill is rotten, the wall cavity is likely okay; however, if the sill is rotted all the way through, be sure to check the wall cavity for damage.
To repair the window, build a new framing member with a notch cut out for the top; secure it in place with a few nails (Image 1).
Cut a new cedar sill with 2 x 6 cedar notched corners to fit in the rough opening and nail it in place (Image 2).
Using a table saw with a dado blade (or with several runs across the table saw blade at a 1/4" depth), cut a kerf into the bottom of the wood sill. A kerf cut allows water dripping off the edge of the window sill to fall to the ground before it wicks its way to the back of the sill and gets into the siding.
If needed, use a circular saw to cut the siding to allow for new trim pieces (if necessary). Be sure to set the circular saw blade to the depth of the siding and no more.
Before reinstalling the window or the trim, fill all holes and cracks made by the saw or pry bar, and cover any exposed wood with insulative paper.
Fit the window back in place and secure it with the impulse nailer using 16-gauge 2-1/2" nails (Image 1).
Cut the trim to size and nail it in place (Image 2).
Fill all nail holes with wood filler. Let dry, sand and repeat if necessary. Use high-quality primer and paint to protect the new windowsill and trim.