Question: how do we know what books are inspired and to be included in the canon of scripture? 

Answer: The Church, guided by the Holy Spirit, recognized the canonical books through tradition and councils.