将*单元格格式*信息从excel文件导入R [英] Importing *cell-formatting* information from excel file into R

查看:31
本文介绍了将*单元格格式*信息从excel文件导入R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了 excel 文件 (.xlsx),其中单元格的格式是我需要捕获的相关信息.感兴趣的关键格式是 (1) 单元格颜色和 (2) 边框(左 + 右、全框或不存在).

I have been given excel files (.xlsx) where the format of the cell is relevant information which I need to capture. The key formatting of interest are (1) cell color and (2) border (left + right, full box or absent).

是否可以将其读入 R 中?

Is it possible to read this into R?

推荐答案

这是一个非常古老的问题,但仍然会出现在搜索中,所以我认为将人们指向 tidyxl 包很有用.

This is a very old question but still comes up in searches so I think it is useful to point people toward the tidyxl package.

tidyxl::xlsx_cells() 读取 Excel 电子表格作为数据框,其中每一行代表电子表格的一个单元格,及其地址(例如 A1)、内容和属性.

tidyxl::xlsx_cells() reads an Excel spreadsheet in as a data frame where each row represents a single cell of the spreadsheet, with its address (e.g. A1), contents, and properties.

tidyxl::xlsx_formats() 返回 Excel 电子表格中所有不同单元格格式的嵌套列表.

tidyxl::xlsx_formats() returns a nested list of all the different cell formats in the Excel spreadsheet.

xlsx_cells() 返回的数据框中的local_format_id 列允许您在xlsx_formats() 返回的列表中查找每个单元格的格式信息).

The local_format_id column in the data frame returned by xlsx_cells() allows you to look up the formatting information for each cell in the list returned by xlsx_formats().

更多信息包含在 tidyxl 包小插图.

这篇关于将*单元格格式*信息从excel文件导入R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆