By means of analytical centrifugation, we study the compression of colloidal gels where attractive forces between the particles are induced by a surfactant, acting as a depletion agent. The approximate pressure sustained by gels with different strength at different centrifugal acceleration is measured from the steady-state profiles of the transmitted intensity, using a conventional method. In the particular case in which the suspension is refractive-index–matched and the profile is directly related to the particle concentration, the equation of state of the gel can be obtained up to the random close-packing limit, highly extending current experimental and numerical data available.