How did David Wallace end up purchasing Dunder Mifflin in The Office? The character, played by Andy Buckley, appeared in all but two of the sitcom's nine seasons. David was initially the paper company's Chief Financial Officer until he grew into a more prominent position later in the series.
David Wallace was introduced in The Office season 2 during the episode titled "Valentine's Day". He took over the role as Dunder Mifflin's CFO after the former CFO resigned due to sexual harassment allegations from a secretary. Despite Michael Scott's questionable work ethics, David always put up with the manager's quirks. David would pop in and out on the series whenever there were conflicts at corporate. His character would also frequently visit the Scranton branch to guide the employees through changes like the case with Charles Miner's hiring or buying out the Michael Scott Paper Company.
In The Office season 6, David hinted that the future of Dunder Mifflin might be in doubt. During the episode "Secret Santa", Michael learned that David and the rest of the corporate employees lost their jobs after Dunder Mifflin was taken over by Sabre. As Michael and the rest of the Scranton office had to adapt to the new changes brought on by Sabre, David disappeared from the series. He then reappeared in season 8 very high on his luck after making a large sum of money from a previous business endeavor. David ended up using some of that money to purchase Dunder Mifflin, making him the new CEO.
While David was out of the job, he invested in an idea he had based on an invention that cleaned up toys on the floor called "Suck It". He had the prototype made and eventually sold Suck It to the U.S. Military for $20 million. After Sabre struggled due to their widespread printer fires, Andy convinced David to buy out the company, reviving Dunder Mifflin and becoming the new CEO. He immediately paid off Robert California to step away as manager and rehired Andy to take over the role.
David remained in a recurring role throughout The Office's ninth and final season. He closely looked over Dunder Mifflin's business operations and eventually fired Andy before hiring Dwight as the permanent Regional Manager. Having another familiar face that was a prominent side character throughout the series was a fitting decision as the end neared.
David appeared in The Office's series finale where he revealed that there was a lot featured in the documentary that he wished he never knew. After some trouble during his early years at Dunder Mifflin, it seemed as though he was in a good position when the series officially ended. It also didn't hurt that he and his family had the Suck It money to fall back on if necessary.