Search code examples
pythonrexcelstrikethrough

How to detect "strikethrough" style from xlsx file in R


I have to check the data which contain "strikethrough" format when importing excel file in R

Do we have any method to detect them ? Welcome for both R and Python approach


Solution

  • R-solution

    the tidyxl-package can help you...

    example temp.xlsx, with data on A1:A4 of the first sheet. Below is an excel-screenshot:

    enter image description here

    library(tidyxl)
    
    formats <- xlsx_formats( "temp.xlsx" )
    cells <- xlsx_cells( "temp.xlsx" )
    
    strike <- which( formats$local$font$strike )
    cells[ cells$local_format_id %in% strike, 2 ]
    
    # A tibble: 2 x 1
    #   address
    #   <chr>  
    # 1 A2     
    # 2 A4