Sensitive detection of gallic acid (GA) in foods is of great significance for assessing the antioxidant properties of products and ensuring consumer health. In this work, a simple electrochemical sensor was conveniently fabricated by integrating vertically-ordered mesoporous silica film (VMSF) with electrochemically reduced graphene oxide (ErGO) and nitrogen graphene quantum dots (NGQDs) nanocomposite, enabling sensitive detection of GA in food sample. A water-soluble mixture of graphene oxide (GO) and NGQDs was drop-cast onto the common carbon electrode, glassy carbon electrode (GCE), followed by rapid growth of VMSF using an electrochemically assisted self-assembly method (EASA). The negative voltage applied during VMSF growth facilitated the in situ reduction of GO to ErGO. The synergistic effects of ErGO, NGQDs, and the nanochannels of VMSF led to nearly a tenfold enhancement of the GA signal compared to that obtained on electrodes modified with either ErGO or NGQDs alone. Sensitive detection of GA was realized with a linear concentration range from 0.1 to 10 μM, and from 10 to 100 μM. The limit of detection (LOD), determined based on a signal-to-noise ratio of three (S/N = 3), was found to be 81 nM. Combined with the size-exclusion property of VMSF, the fabricated sensor demonstrated high selectivity, making it suitable for the sensitive electrochemical detection of gallic acid in food samples.