Miniaturized spectrometers have become increasingly important in modern analytical and diagnostic applications due to their compact size, portability, and versatility. Despite the surge in innovative designs for miniaturized spectrometers, significant challenges persist, particularly concerning manufacturing cost and efficiency when devices become smaller. Here we introduce an ultracompact spectrometer design that is both cost-effective and highly efficient. The core dispersion element of this new design is a graded photonic crystal film, which is engineered by applying gradient stress during its fabrication. The film shows bandstop transmission spectral profiles, akin to a notch filter, enhancing light throughput compared to conventional narrowband filters. The spectral analysis, with a resolution of 5 nm and operating within the wavelength range of 450-650 nm, is conducted by reconstructing the spectrum from a series of such notch transmission profiles along the graded photonic crystal film, utilizing a sophisticated algorithm. This approach not only reduces manufacturing costs but also significantly improves the sensitivity (with a light throughput efficiency of 71.05%) and overall performance of the limitations of current technology, opening up new avenues for applications in diverse fields.