Some 1,700 people work at the YouTube HQ. The company is owned by Google and is the area’s biggest employer.
Images broadcast on local TV stations showed employees leaving with their hands raised. Other footage appeared to show evacuees forming a queue before being individually frisked by police.
Video captured by a nearby helicopter showed a glass door shattered in its centre, with glass fragments strewn across the ground outside.
The three wounded were taken to Zuckerberg San Francisco General Hospital. Officials said the 32-year-old woman’s condition was serious and the 27-year-old’s condition was fair.
A fourth person was also taken to hospital with an ankle injury sustained while trying to escape, Mr Barberini said.
YouTube spokesman Chris Dale praised the police response to the incident.
“Today it feels like the entire community of YouTube and all of the employees were victims of this crime. Our hearts go out to those who suffered in this particular attack,” he said.
Several YouTube employees tweeted about the attack as it was taking place.
Product manager Todd Sherman said people fled the building in panic as the shooting unfolded.