Extrude faces to fit shape

I want to extrude faces to fit a custom shape from a second mesh. Like on the pictures.



Faces to extrude.


Shape the extruded faces should match.


Final result, extrusion stopped when shape is matched.

How can i get a similar result without doing this for every face by hand?

Thanks in advance,
Polygonaut

Bottom view and face snapping on.

@ JuhaW, would be nice if you can explain a bit more, i quite do not understand how to use your short tipp. Is it an addition to eppo´s solution to keep the faces flat?

Thanks

Bottom view and press G (grab), it will project your vertices to faces.

ahaa…Flat faces…first snapping magnet off…pivot point to individual origins and S+Z+0

Honestly i was confused too a bit. But snapping could be another option. Never used it in such a way, nice tip!
I did not had the luxury for SZ0 coz i used Grid and squares had corner edges connected; my fault for not looking into image enough.

Both methods are nice ways to do the job. I think using the Shrinkwrap mod is a bit more flexible, you can change the shape-object on the fly and you can adjust the shape´s position in 3D Space and the extruded faces will follow.

Thank you guys!