如何从 R 中的 xlsx 文件中检测“删除线”样式

ran*_*ane 4 python excel r strikethrough

在R中导入Excel文件时,我必须检查包含“删除线”格式的数据

我们有什么方法可以检测到它们吗?欢迎使用 R 和 Python 方法

Wim*_*pel 6

R-溶液

-packagetidyxl可以帮助你...

例如 temp.xlsx,其中数据位于第一张纸的 A1:A4 上。以下是 Excel 屏幕截图:

在此输入图像描述

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   
Run Code Online (Sandbox Code Playgroud)