I would take the bus from Barcelona to Andorra. I just did it this summer, there are many busses daily and it is under 3 hours each way. Going to Andorra first before Barcelona won't really save any time unless driving, in which you could probably save a couple hours total.