If it works as AA seems to theorize, you'd need to:
(a) work out how Google books exposes fragments of books, and see if there's a systematic way of using this to get whole books. For example, a naive approach might be to find any fragment of the book by searching some exact phrase. Then, you can search for an exact phrase from the start or end of the fragment it gave you, hoping it will show you the previous or next part of the book. You can then just loop that to get the whole book.
(b) once you have (a), you need a way of bypassing Google's bot detection/rate limiting. I don't know what current state of the art is, but there may be a solution for sale out there. E.g. you pay to receive a cookie or browser state, and use that to fetch the URLs from (a). Or if you're good/already in the scene, you could do this part yourself.