Read_excel() function automatically skips leading empty rows. Is there a way to avoid this as I need the row.names in R to correspond with row numbers in excel? 
It is impossible to satisfy this objective when I am unaware how many leading rows were skipped by read_excel.
If you don't know in advance what cells might be missing/available, you can use:
readxl::read_excel(path, col_names = FALSE,
                   range = cellranger::cell_limits(ul =c(1L, 1L)))
This will read all cells.  It specifies the upper-left ul corner of the desired cell range and automatically picks the bottom right.
You can use the range argument of the read_excel function as the documentation for this argument of the function says:
A cell range to read from, as described in cell-specification. Includes typical Excel ranges like "B3:D87", possibly including the sheet name like "Budget!B2:G14", and more. Interpreted strictly, even if the range forces the inclusion of leading or trailing empty rows or columns. Takes precedence over skip, n_max and sheet.
Additionally, you might want to set col_names = FALSE, such that the row-numbering stays the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With