For both coffee and red wine, blotting right away is essential. Use a clean white cloth or paper towel to gently absorb as much liquid as possible, always dabbing from the outer edge toward the center to avoid spreading the stain. Rubbing is a no-no—it can push the pigment deeper into fibers and damage carpet or upholstery
https://rochestercarpetcare.com/coffee-wine-stain-removal-from-carpets-upholstery/