I've rescued a couple of keyboards from the trash heap by running them through the dishwasher. Put the dishwasher on light cycle do not use any soap and set it not to dry... then let it air dry for a few days.

(I had to witness the results before I believed it myself.)

I’ve only used it as a last option but it really cleans the coffee out of a keyboard!