Read: Ezra 6
This chapter makes a long story short, but the Temple is completed.
Apparently God had these kings keep careful records just so His opponents could be defeated. It is amazing how seemingly unrelated things can be brought together to accomplish what God wants to do. Stories like these can still be heard today.