I can't get a name of tilemap's tile sprite

I am programming a 2d strategy game and I’m having trouble getting the name of tile’s sprite name.
Here’s my code:

n = name;
        var pos3 = GameObject.Find(n).transform.position;
        Vector3Int coordinate = grid.WorldToCell(pos3);
        Sprite sprite = myTileMap.GetSprite(coordinate);
        if(sprite != null)
            string tilename = sprite.name;

Variable “sprite” returnes null. Any ideas what I did wrong?

Figured it out myself so I’m going to post my solution here for others that might have the same problem.

    void Update()
        string name2 = "";
        int i = 0;
        n = name;
        var pos3 = GameObject.Find(n).transform.position;  // find your pos
        Vector3 coordinate = grid.WorldToCell(Vector3Int.RoundToInt(pos3));  //convert your pos to tilemap's pos
        Vector3 one = new Vector3(1,1,0); //calculate compensation vector
        coordinate = coordinate - one; // compensate
        TileBase TileBase = myTileMap.GetTile(Vector3Int.RoundToInt(coordinate)); // find the tile
        name2 = TileBase.ToString(); // take the name of the tile