Atiyah-Hirzebruch spectral sequence in band topology: General formalism and topological invariants for 230 space groups