'Don't skip empty leading rows when using readxl

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.



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Michael Dewar