'R merge xlsx workbooks into multi tabbed file
I've been playing with both XLConnect and openxlsx trying to solve a tricky problem. I have multiple xlsx files, created by users. The formatting and layout is very specific to excel and I do not need to ingest the data as a data frame. I need to extract the data from each file, in the excel format, combine it and write it as a multi-tabbed xlsx.
Example file, they all look nearly identical except the sheet names are different.
I can't paste an image of the data, but let's say there are 10 xlsx files, all nearly identical except for some numeric diffs. ALl have bold cells, underlines, borders, fill and font colors I need to preserve. If I load the workbook, I can see the style elements, str(wb$styleObjects). But I can't figure out how to apply these to a raw data frame. Or, how to extract a worksheet object from a workbook and add it to a new workbook.
wbs <- list()
for (i in seq_along(files)) {
wbs[[i]] <- XLConnect::loadWorkbook(fls.req[i])
}
This results in a list of XLConnect workbook objects. How can I write these all to one workbook? I've tried to load them as worksheets but that turns the data into data frames and I lose all formatting.
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
