I have a xlsm file (please look at the photo below) and I want to:
- Skip the first 4 rows
- Use the 5th row as variables names
I tried with read_csv("Sujet8.xlsm", skip = 4)
but it returned me this error:
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
no lines available in input
In addition: Warning messages:
1: In readLines(file, skip) : line 1 appears to contain an embedded nul
2: In readLines(file, skip) : line 2 appears to contain an embedded nul
3: In readLines(file, skip) : incomplete final line found on 'Sujet8.xlsm'
I tried also readxl
package.
data_types = c("text","text")
my_data = read_excel("Sujet8.xlsm", sheet = "Sheet2", skip = 4, na = "n/a", col_types = data_types)
But it returned me this error:
Error in read_fun(path = path, sheet = sheet, limits = limits, shim = shim, :
Sheet 1 has 52 columns, but `col_types` has length 2.
How can I fix this? Sorry I can't share the file because it is for internal use only. But here is how it looks.