Using numerical simulations, we study using near-infrared (NIR) light to drive an adjustable transmission grating made from graphene nanoplatelet (GNP) and polydimethylsiloxane (PDMS), changing its grating period and diffraction wavelength to detect acetylene gas, which has an absorption peak in the near-infrared band. We simulated the optical drive in different directions (along or perpendicular to the grid line) to study how this affects the grating period. When driven along the grating line, the grating period decreases with increasing optical drive time, the variation range in the middle of the grating is higher than on the two sides, and the maximum adjustable range can reach 36.12 nm. In contrast, when driven perpendicular to the grid line, the grating period increases with increasing optical drive time, the variation range in the middle is lower than on the two sides, and the maximum adjustable range can reach 78.60 nm. Both methods can detect acetylene gas, but driving perpendicular to the grid line enables a larger range of grating periods, greater stability, and superior performance.