Preheat oven to 350°F (175°C). Grease and flour a 9×13-inch baking pan or line with parchment paper.
In a medium bowl, whisk together flour, baking soda, baking powder, salt, cinnamon, and nutmeg.
In a large bowl, beat eggs, oil, both sugars, and vanilla until smooth.
Stir in grated zucchini.
Add dry ingredients to wet in batches. Fold until just combined. Do not overmix.
Fold in chopped walnuts if using.
Pour batter into prepared pan and smooth the top.
Bake for 35–40 minutes or until a toothpick inserted comes out with a few moist crumbs.
Cool in pan for 30 minutes, then transfer to a wire rack to cool completely.
For frosting, beat butter, cream cheese, cinnamon, and vanilla until light and fluffy. Gradually beat in powdered sugar until smooth.