Scroll: Glyph of Guard

If a wizard has a roll of "protection glyph" (gow), could they do it at the time of casting, store a spell if they had remaining spell slots and a prepared spell that can be put into gow?