There is no connectivity between Thanjavur & Trivandrum, You can come to trichy from trivandrum by 16128 Guruvayur-chennai express or 16724 Ananthpuri express( Prefer 16128 for better arrival timings), from trichy you can easily get bus connectivity for thanjavur, every 2min which would take around 1nd half hour...