Using SkyChoord to read in multiple coordinates.
From the documentation

&gt;&gt;&gt; c1 = SkyCoord(ra=10*u.degree, dec=9*u.degree, distance=10*u.pc, frame='icrs')
&gt;&gt;&gt; c2 = SkyCoord(ra=11*u.degree, dec=10*u.degree, distance=11.5*u.pc, frame='icrs')
&gt;&gt;&gt; c1.separation_3d(c2)  
&lt;Distance 1.5228602415117989 pc&gt;


The rest of the code is just reading the excel files and printing the results. What you have now is incorrect, even without the "z" coordinate. You can't calculate the separation of two points in spherical coordinates by Pythagoras' theorem: eg (30*, 0*) and (30*, 359*) should be very close. You need to convert to cartesian coordinates first, which is what the astropy module does.