Search code examples
juliajulia-dataframe

Dataframe gets cut before an empty row in an excelfile


I have an excel file which has 79 rows and 12 columns.

The problem I have is that when I run the following code, I only get 8 rows and 1 column. Row 9, is an empty row, and I think this is the problem. But I don't know how to get by this problem. I have tried using missing, ismissing, allowmissing and dropmissing in different ways. But nothing I've tried has worked for me.

using DataFrames, XLSX
df = DataFrame(XLSX.readtable("file.xlsx")...)
println(df)

Is the empty row a problem, and how can I handle that empty row? Or is there something else that might cause the problem that I only get 8 rows and 1 column?


Solution

  • From the XLSX.jl documentation:

    stop_in_empty_row is a boolean indicating wether an empty row marks the end of the table. If stop_in_empty_row=false, the TableRowIterator will continue to fetch rows until there's no more rows in the Worksheet. The default behavior is stop_in_empty_row=true.

    so set stop_in_empty_row=false to read in empty rows as missing