about 2000 Km by road - less by air. No direct flight from Glasgow - Sleazyjet fly Edinburgh to Madrid though, 4 hour flight time (3 with time difference).
Indirect flights (1 stop) showing up on Travelocity take about 6 hours (5 with time difference)
If you're interested in the straight line flight distance ("as the crow flies"), the total distance from Glasgow to Madrid is 1,066 miles. This is equivalent to 1,715 kilometers or 926 nautical miles. You can check the following link to find more info on the distance from Glasgow to Madrid.