In someone's bad books
To be in disgrace or out of favour.
In the Middle Ages 'one's books' was understood to mean 'one's reckoning or cognizance', ie: the esteem in which one was held by others. To be 'out of someone's books' meant you were no longer part of their life and of no interest to them. This meaning is first recorded in The Parlyament of Deuylles, 1509 - "He is out of our bokes, and we out of his". The use of books to indicate favour or disfavour is enshrined in several phrases - 'good books', 'bad books', 'black books'.
The first of these was 'black books', which appears to have originated by allusion to an actual book. In 1592, Robert Greene published his intention to create a Blacke Booke, which was to list the misdemeanors of various classes of criminal. As a preamble he wrote his Black Book's Messenger, which included:
"Ned Brownes villanies which are too many to be described in my Blacke Booke."
This phrase had become used figuratively by 1785 (that is, as a form of disfavour, but where no actual book was in evidence) when it was recorded in Grose's Dictionary of the Vulgar Tongue:
"He is down in the black book, that is, has a stain in his character."
'Bad books' arrived on the scene later and is first recorded in Perry's History of the Church of England, 1861:
"The Arminians, who at that time were in his bad books."