I'm trying to assign the name of each list element to the sheetName in write.xlsx, while creating new sheets for each element. I'm not sure how to work out the sheetNumber part in order to get the elements in the same sheet. Here is an example:
list_df = list('a'=data.frame(test1=NA,test2=NA),'b'=data.frame(test3=NA,test4=NA))
purrr::imap(list_df, ~write.xlsx(.x, "test.xlsx", sheetName = .y))
Note that this new edit was a partial solve by another member.