Loop exporting to excel file- writeWorksheetToFile

I need to read multiple dta files and exporting the content of a variable
called "name". My idea is to aggregate to the right each "name" from each
dta file. I made a simple loop and I know It works reading the dta files.
However, It can't say the same exporting the data.

Here is what I wrote:

options(java.parameters = "-Xmx4096m")

file = list.files(pattern="\\.dta$")
myFiles <- list.files(pattern = "\\.dta$")

for(i in myFiles){
    for (j in 1:length(file)) {
  myDf = read_dta(i) 

  writeWorksheetToFile("datos.xlsx",data=plop, sheet="variables",startRow=1, startCol=j)
Every time I run the code I received a message with "Error: POIXMLException
(Java): java.lang.reflect.InvocationTargetException".
And when I opened the excel file, It only contained in the first column
infomatio (plop) of the first dta file.
I have no idea what else to do. The error seems related to the intent to
export the data to excel than reading the files.
Thanks for your time and interest.