I probably would say, "I had been inputting the data for two hours when the computer suddenly crashed" Or in an attempt to minimize changes to your sentence, "I had spent two hours inputting the data WHEN the computer suddenly crashed"0-
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.