If you are using the 5e OGL sheet, then the "5th Edition OGL by Roll20 Companion" script can do this automatically when the spell is clicked on the character sheet. Optionally, if you have some other method of casting the spell (custom macro, etc.) you can use the ChatSetAttr script to deduct slots using the attributes "lvl1_slots_expended", "lvl2_slots_expended", etc..