tab_spanner_delim()
Use iris to create a gt table and use the tab_spanner_delim() function to automatically generate column spanner labels. This splits any columns that are dot-separated between column spanner labels (first part) and column labels (second part).
iris
iris |> dplyr::group_by(Species) |> dplyr::slice(1:4) |> gt() |> tab_spanner_delim(delim = ".")