2 pounds small zucchini, shredded on the large holes of a box grater
3 tablespoons unsalted butter
1 small shallot, minced
1/2 cup heavy cream
1/2 cup shredded Gruyère cheese (1 1/2 ounces)
Preheat the broiler. Put the shredded zucchini in a large colander and toss with 1/2 teaspoon of salt. Let the zucchini stand for 5 minutes, then squeeze as much liquid out of the zucchini as possible.
In a large nonstick skillet, melt the butter. Add the minced shallot and cook over moderate heat until the shallot is softened, about 3 minutes. Add the shredded zucchini and cook over high heat, tossing, until the zucchini is just softened, about 2 minutes. Add the heavy cream and simmer until thickened, about 1 minute. Remove the zucchini from the heat and season with salt. Transfer the zucchini to a shallow baking dish. Scatter the Gruyère on top of the zucchini and broil 4 inches from the heat for 1 minute, or until the cheese topping is golden brown. Serve the zucchini gratin right away.