I want to import an excel file to R. The excel file already has an implemented header which contains important information, but this header is not imported to R. What I tried:
library(openxlsx)
read.xlsx #cuts off the header
converting to csv #cuts off the header
converting to pdf, from pdf to txt #cuts off the header
Am I missing an obvious solution? I don't need the data of the header in any specific format, as part of the dataframe or as an ugly string, just so that I can extract it, and that extraction has to happen within the R-environment (not manually in Excel).
Edit: I have tried to upload another simplified version of an excel file with header, and it also didn't work. It seems to be a problem of the header itself, not its content
I think this will work:
x <- loadWorkbook("examplexl.xlsx")
sheet1 <- x$worksheets[[1]]
headers <- sheet1$headerFooter
> headers
$oddHeader
$oddHeader[[1]]
NULL
$oddHeader[[2]]
[1] "Center header"
$oddHeader[[3]]
[1] "Right header\nInfo"
My "examplexl.xlsx" looks like: