If the person in question is still working in the office, we’d normally use the present tense: «Як до́вго ви працю́єте в о́фісі».
Цей курс постійно нехтує правилами про в/у та і/й... :(
Why not "How long were you working in the office" Imperfective tense. It's not known whether the work is permamently terminated or not
I don't know if it should be accepted, but a common way to say something similar is "for how long did you work from the office.". Same meaning, but maybe a different translation.