This bookmarklet can be used to produce a clickable list of spells for an NPC chat macro. You input the spell level (0 for cantrips), the number of slots available for that level, and it will produce the markup to put into a chat macro.
As far as building the shell for the spellbook is concerned, this should get you started:
/w GM &{template:default}{{name=@{selected|character_name} Spellcasting
}}{{ DC @{selected|spell_save_dc} = +@{selected|spell_attack_bonus} to hit
}}{{ Cantrips = [@{selected|repeating_spell-cantrip_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell)