unit – Procedure for storing multicell objects on a sparse grid (example: buildings in Anno)

I'm currently working on an urban building game and planning the storage of buildings on the map.

In previous projects, I used a grid where each object had exactly 1 cell; or Unity Objects placed freely in the scene using collision detection.

While the second method would work simply by cutting out objects in grid coordinates, I hope to achieve better relationship management by using a grid while maintaining multicellular buildings.

An example of 2 buildings on the grid

For a reference, see Anno. The grid is quite small compared to the smallest buildings. At the same time, most of the map is unused. So I would prefer not to have an array for the whole map, but rather a clean data type storing only the cells used.
All cells need to know which building they occupy and to create and remove buildings should work without too much work. Buildings must also know their neighboring cells.

I plan to use ECS for behind-the-scenes management of buildings. But I guess I'll still need color boxes for the mouse to work

More generalized development not Gamedev:
How does Exel work? I guess it only stores the cells with the content. Cell fusion is possible and cell-based, I can easily get its content, whether it's a sub-cell address of a merged cell.

Tips for creating a data type?