Finding a way to use pivot_wider and the gt package to create a table

Is this what you mean?

library(tidyverse)
library(gt)

df <- tibble::tribble(
    ~pop,                     ~porte,               ~meso,
    2630L,        "Micro (0 - 5.000)",           "Serrana",
    17717L, "Pequeno (5.001 - 25.000)", "Oeste Catarinense",
    10272L, "Pequeno (5.001 - 25.000)",    "Vale do Itajaí",
    5306L, "Pequeno (5.001 - 25.000)",    "Vale do Itajaí",
    7132L, "Pequeno (5.001 - 25.000)", "Oeste Catarinense",
    6379L, "Pequeno (5.001 - 25.000)", "Oeste Catarinense"
)

df %>% 
    pivot_wider(id_cols = porte, names_from = meso, values_from = pop, values_fn = sum) %>% 
    gt()