So, what you have there is an integer and, of course, it doesn't need to be coerced to an integer, because it already is one, your function is iterating over a list of integers, so SummaryData[[i] isn't responsible.
writeData 's sheet argument accepts either a tab name or number, so it doesn't have to be coerced.
That leaves WbObjectList as the suspect.
i <- 1
WbObjectList[i]
[[1]]
[1] "wb" "wb" "wb" "wb"
str(WbObjectList[i])
List of 1
$ : chr [1:4] "wb" "wb" "wb" "wb"
class(WbObjectList[i])
[1] "list"
writeData(WbObjectList[i] )
Error in writeData(WbObjectList[i]) :
argument "x" is missing, with no default
meaning that writeData was expecting a workbook object containing a data sheet and got a list, instead
Now we could try to get around this
WbObjectList[[1]][i]
[1] "wb"
but we get a character object, not a workbook object, which is because
WbObjectList <- list(rep('wb', length(SummaryData)))
repeats the string "wb" 4 times, not wb as defined above
What happens when we change the definition of WbObjectList?
WbObjectList <- list(rep(wb, length(SummaryData))) # without the single quotes around wb
I can't test that because I don't have any xlsx files, but why don't you try and report back?