GUIs and extracting items

I'm making a new block called the Infusion Pedestal, where you can infuse and extract spells from wands. Wands can have up to 10 spell slots, and you will be able to get spell scrolls that contain a bunch of custom data. Depending on the GUI slot you put the spell scrolls, pressing the "infuse" button will replace the corresponding spell slot in the wand (if it is empty). I'm pretty sure I know how to do this, but I'm not sure how to extract spells out of spell slots, turning them back into spell scrolls. I also need some general help with creating a functional GUI.
Continue to help post