The squirrels are in the Nut Sorting Room. Their job is to separate the good nuts from the bad nuts. Willy Wonka says the reason why they use squirrels instead of Oompa Loompas is because Oompa Loompas can't get the nut in whole. They always break them in half.
Connection to Veruca Salt
In the 2005 movie, Veruca Salt disobeys her father and Willy Wonka after being told the squirrels are not for sale and she can't have one. Veruca goes into the Nut Sorting room where the squirrels attack her. One of them, thinking she's a nut, taps her on the head and the squirrels shove her down the garbage chute, thinking she is a "bad nut".