Spinach usually bolt (go to seed) when days start getting longer and temperatures become warmer in the Spring. According to my dated book here they start to flower when days last at least 14 hours and temperatures are over 75F.
Cool season cultivars tend to get taller and and with few leaves, exactly like you saw.
What to do? You can t-r-y one of the bolt-resistant cultivars developed over the past decade: they will bolt eventually, but will do so later in the season. According to literature the two most bolt-resistant cultivars are Spinner and Correnta.
Another thing to do is to try and keep temperature and lighting under control. If you can keep temperature under 80F or so you have good chances of success with one of the bolt-resistant cultivars. You should also set the grow light timers to provide an even 12 hours of light and darkness every day.
That's all I can think of: I've never had much success with grow lights myself.