Hepatocellular carcinoma (HCC) is the fourth main reason of cancer-related death. Codonopsis pilosula is a commonly used traditional Chinese medicine (TCM) for patients with HCC. However, its potential mechanism for treatment of HCC remains unclear. Here, we used transcriptomics and network pharmacology to explore the potential molecular mechanisms of Codonopsis pilosula . In our study, twelve differentially expressed genes (DEGs) (5 upregulated and 7 downregulated) of Codonopsis pilosula treating HepG2 cells (a kind of HCC cell) were identified. Among the 12 DEGs, HMOX1 may play an essential role. Codonopsis pilosula mainly affects the mineral absorption pathway in HCC. We acquired 2957, 1877, and 255 targets from TCMID, SymMap, and TCMSP, respectively. Codonopsis pilosula could upregulate HMOX1 via luteolin, capsaicin, and sulforaphane. Our study provided new understanding of the potential pharmacological mechanisms of Codonopsis pilosula in treating HCC and pointed out a direction for further experimental research.