Preheat your oven to 350°F (175°C). Grease and flour a 9x13 inch baking pan.
In a large mixing bowl, whisk together the flour, granulated sugar, brown sugar, baking powder, baking soda, cinnamon, nutmeg, and salt.
In another bowl, mix the applesauce, vegetable oil, and vanilla extract. Add the wet ingredients to the dry ingredients and stir until just combined.
Fold in the grated carrots and chopped walnuts (if using).
Pour the batter into the prepared baking pan and spread it out evenly.
Bake for 45 minutes or until a toothpick inserted into the center comes out clean.
Let the cake cool in the pan for 10 minutes, then transfer to a wire rack to cool completely.