My initial instinct would be to look at
GetSpellBookItemInfo().
There are other related functions listed
here.
This is all depending on what you actually want to do with the spell buttons. Another suggestion is to look at what Blizzard does with it and how it's set up.
SpellBookFrame.xml has the template the buttons are created from and
SpellBookFrame.lua contains its underlying code.