"for" seems much more likely in this scenario. "to" makes it seem as if the bringing of the books was an instruction, or part of an organised exercise of some sort. It's simpler to say "Thanks for bringing me all the books".
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.