How to fill a gap between wall and ceiling?
Before you do that, check out how air is getting into and out of that office. That big gap at the top may be there because there is no heating and/or air conditioning register in that room, so its air is just allowed to mix with the rest of that living area via that gap. Closing it up without thinking it through will result in a "dead zone" in terms of air comfort.