To explore the necessity and safety of selective endoscopy to detect gastrointestinal (GI) malignancy during the outbreak of coronavirus disease 2019 (COVID-19). A retrospective cohort study was carried out to analyze the clinical data of selective endoscopy performed at the Endoscopic Center, Zhongshan Hospital of Fudan University from February 20 to March 6, 2020. Clinical data included epidemiological questionnaire, chief complaints, endoscopic findings and biopsy pathology results, etc. All medical staff had blood test for IgM/IgG antibodies of COVID-19. Patients and their families were followed up by phone to determine whether they were infected with COVID-19. Meanwhile, the clinical data of selective endoscopy during the same period from February 20 to March 6, 2019 were collected as the control group to compare the overall results of endoscopy examinations during the epidemic and the detection rate of GI malignancy. A total of 911 patients underwent endoscopy in the epidemic period group, and a total of 5746 cases in the control group, which was 6.3 times over the epidemic period group. In the epidemic period group, 544 cases received gastroscopy and 367 cases received colonoscopy, while 3433 cases received gastroscopy and 2313 cases received colonoscopy in the control group, which were both 6.3 times of epidemic period group. Gastroscopy revealed that 39 patients (7.2%) were diagnosed with upper GI malignancies in the epidemic period group and 77 patients (2.2%) in the control group with significant difference (χ(2)=40.243, <0.001). The detection rate of gastric cancer in these two groups was 3.3% (=18) and 1.7% (=59) respectively with significant difference (χ(2)=6.254,=0.012). The detection rate of esophageal cancer was 3.7% (=20) and 0.5% (=18) respectively with significant difference (χ(2)=49.303,<0.001). Colonoscopy revealed that colorectal cancer was found in 32 cases (8.7%) of the epidemic period group and 88 cases (3.8%) of the control group with significant difference (χ(2)=17.888, <0.001). During the epidemic period, no infection of medical staff was found through the blood test of IgM/IgG antibodies on COVID-19. No patient and family members were infected with COVID-19 by phone follow-up. Compared with the same period in 2019, the number of selective endoscopy decreases sharply during the epidemic period, while the detection rate of various GI malignant tumors increases significantly, which indicates that patients with high-risk symptoms of GI malignancies should still receive endoscopy as soon as possible. Provided strict adherence to the epidemic prevention standards formulated by the state and professional societies, it is necessary to carry out clinical diagnosis and treatment as soon as possible.