Preheat oven to 350 degrees F. Grease and flour a 9x13 inch pan.
Whisk the flour, baking powder, baking soda, cinnamon, nutmeg, and salt in a medium bowl. Set aside.
In a large bowl, whisk the oil, granulated sugar, and brown sugar together until combined.
Whisk in the eggs one at a time, then the vanilla extract, until smooth.
Fold the dry ingredients into the wet ingredients just until combined.
Gently fold in the grated zucchini and walnuts, if using.
Pour into the prepared pan and bake for 35 to 40 minutes, until a toothpick comes out clean.
Cool completely in the pCooling The Best Zucchini Cake Recipe (Moist, Spiced, Never Soggy)an on a wire rack before frosting.
Beat the cream cheese and butter until smooth, add powdered sugar gradually, then mix in vanilla and salt until fluffy.
Spread the frosting evenly over the cooled cake with an offset spatula, then slice and serve.