Covalent organic frameworks (COFs) have been a potential candidate for applications in photocatalysis due to their periodical porous structures and tunable structures. The COF skeletons consisting of different building blocks may result in different performances. Investigating the effects of different building blocks on energy levels and excitons for COFs can provide some insight into designing excellent COF catalysts. In this work, based on the first-principles many-body Green’s function theory, the electronic structures and optical properties of the three donor-acceptor COFs are calculated by employing the monomer 2,4,6-trimethyl-1,3,5-triazine (TMT) as the key acceptor subunit and the trigonal aldehyde monomers including the tris (4-formylphenyl) amine (TPA), 1,3,5-tris (4-formylphenyl) benzene (TFPB) and 2,4,6-tris (4-formylphenyl)-1,3,5-triazine (TFPT) as the donor subunit. The regulations of the donor unit and interlayer interactions on the electronic structures and excitonic properties are analyzed. The results show that the valence band maximum (VBM) and conduction band minimum (CBM) energies of the systemvary with donor subunit. From TPA to the TFPB or TFPT, the bandgap of the system increases, the light absorption is blue shifted, and the exciton binding energy gradually increases. Replacing the TFPB with the TFPT has little effect on the band gap and excitation energy. Among the three COFs, the positions of both CBM and VBM of the TFPT-TMT COF are well-aligned with the chemical reaction potentials of H
2/H
+ and O
2/H
2O, making the TFPT-TMT COF capable of photocatalytic overall water splitting. But the photocatalytic performance for the TFPT-TMT COF might be inhibited by the higher exciton binding energy. The exciton for the TPA-TMT COF is easier to identify according to the exciton distributions and the exciton binding energy. The effects of different building units on the electronic structure, excitation energy, and excitonic properties of COFs in monolayer COFs are consistent with those in multilayer and bulk COFs. The variations of the energy levels and excitation energies of all the three COFs with the number of layers are consistent. With the increase of number of layers, the VBM and CBM shift up and down with respect to the vacuum level, respectively. The band gap gradually decreases. The energy tends to decrease more slowly as the layer number increases. The exciton energies for multilayer COFs are close to those of the bulk states. These results are significant for designing and modifying COFs.