  Galaxy submillimetre number counts are a fundamental measurement in our
understanding of galaxy evolution models. Most early measurements are obtained
via single-dish telescopes with substantial source confusion, whereas recent
interferometric observations are limited to small areas. We used a large
database of ALMA continuum observations to accurately measure galaxy number
counts in multiple (sub)millimetre bands, thus bridging the flux density range
between single-dish surveys and deep interferometric studies. We continued the
Automated Mining of the ALMA Archive in the COSMOS Field project (A$^3$COSMOS)
and extended it with observations from the GOODS-South field (A$^3$GOODSS). The
database consists of ~4,000 pipeline-processed continuum images from the public
ALMA archive, yielding 2,050 unique detected sources. To infer galaxy number
counts, we constructed a method to reduce the observational bias inherent to
targeted pointings that dominate the database. This method comprises a
combination of image selection, masking, and source weighting. The effective
area was calculated by accounting for inhomogeneous wavelengths, sensitivities,
and resolutions and for spatial overlap between images. We tested and
calibrated our method with simulations. We derived the number counts in a
consistent and homogeneous way in four different ALMA bands covering a
relatively large area. The results are consistent with number counts from the
literature within the uncertainties. In Band 7, at the depth of the inferred
number counts, ~40% of the cosmic infrared background is resolved into discrete
sources. This fraction, however, decreases with wavelength, reaching ~4% in
Band 3. Finally, we used the number counts to test models of dusty galaxy
evolution, and find a good agreement within the uncertainties.
