knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
forgts leverages readxl, tidyxl, and unheadr to read a spreadsheet and its formatting information and produce a gt object with the same cell and text formatting as the input file.
The main function in this package is forgts::forgts()
, which simply takes path to an xlsx file and an optional sheet number.
The text and cell formats currently supported include:
Please note that formatting in the headers is ignored intentionally in this package, and that the cell and text formatting is added iteratively on top of gt defaults. The gt object produced can be styled further or exported.
forgts ships with an example spreadsheet file (rodentsheet.xlsx
) that looks like this:
knitr::include_graphics("img/spsheetog.png")
The function forgts()
will read the file and produce a gt object.
library(forgts) ### example_spreadsheet <- system.file("extdata/rodentsheet.xlsx", package = "forgts") forgts(example_spreadsheet) # note that the resulting gt is responsive to dark and light modes on a browser
forgts()
may be used in RMarkdown and Quarto documents, and the resulting gt tables may be exported with gt::gtsave()
.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.