In the current study, by employing first-principles computations, the adsorption behavior of letrozole (LET) was investigated on the pristine graphdiyne nanosheet (GDY) as well as Si-doped graphdiyne (SiGDY). According to the adsorption energy, charge transfer value, and the change in the bang gap energy, the tendency of the pristine GDY towards LET is insignificant. However, the interaction of LET with SiGDY was strong and the adsorption energy was approximately − 19.20 kcal/mol. In addition, the associated electrical conductivity with SiGDY increased by approximately 23.53 % following the adsorption of LET. The results show that SiGDY can be employed as an electronic sensor to detect LET. Furthermore, LET is detected by SiGDY in the water phase based on the magnitude of solvation energy. Finally, a considerable charge-transfer between LET and SiGDY is a precondition for the adsorption of the LET molecule with proper binding energies, which delivers the Si atoms with a significant positive charge.