I'm encountering an error when trying to export a dataframe using the writexl package.

I'm trying to export a dataframe using the writexl package, but I keep getting the same error saying I don't have permission to save the file.

listaprimata_xlsx <- "C:/Users/Users/Desktop/gustavo/R/R tutorial"
writexl::write_xlsx(x= primatas_uc, path= listaprimata_xlsx)
[ERROR] workbook_close(): Error creating 'C:\Users\Users\Desktop\gustavo\R\R tutorial'. System error = Permission denied
Erro: Error in libxlsxwriter: 'Error creating output xlsx file. Usually a permissions error.'

what does

dir.exists(listaprimata_xlsx)

return?

Is "Users/Users" a typo or does that path actually exist?

"when I use the getwd() command to see the directory, it shows as 'user/user'."
"C:/Users/Users/Desktop/gustavo/R/R tutorial"

dir.exists(listaprimata_xlsx)
[1] TRUE
but i cant find the exported data

What if you change the path to this?

listaprimata_xlsx <- "C:/Users/Users/Desktop/gustavo/R/R tutorial/temp.xlsx"

If R tutorial is directory, as your output here suggests:

then the problem may be trying to convert a directory into a file.