Open In App

Read xlsb files in R

Last Updated : 16 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

A XLSB file is an Excel binary worksheet file that was created by Microsoft. In contrast to other Excel files, they hold information in binary format. The fact that XLSB files are binary means that they can be read and written much more quickly, which makes them helpful for large spreadsheets. In this article, we are going to see how we can read XLSB files in the R programming language.

read_xlsb() method

We are going to use the read_xlsb() method to read xlsb files in R. It comes within the library readxlsb. To install the library type the following command in the R environment:

install.packages("readxlsb")

Syntax:

read_xlsb(path, sheet = NULL, range = NULL, col_names = TRUE,  col_types = NULL, na = "", trim_ws = TRUE, skip = 0, ...)

Parameters:

  • path: The path of the file.
  • sheet: The name or the sheet's index that should be read.
  • range: A named range or a string that represents an excel range
  • col_names: A boolean used to specify whether to use the first row as column name.
  • col_types: The type of the columns.
  • na: A single string or an array of strings to represent missing
  • trim_ws: A boolean to whether trim whitespaces
  • skip: The number of rows to skip.

Read xlsb files using the read_xlsb() method

In this example, firstly we are importing the readxlsb package and then storing the path of data.xlsb file in the "filePath" variable and then read that file using read_xlsb() method. 

R
library(readxlsb)

filePath<-"/home/aayussss2101/Desktop/geeksforgeeks/data.xlsb"

read_xlsb(filePath,range="data!A1:F5")

To run the file using the command:

Rscript file.R

Output:

File_output
File Output

Similar Reads