https://github.com/janmarvin/ovbars
Accesses the 'ovba' rust library to extract vba binary files
https://github.com/janmarvin/ovbars
r r-package vba
Last synced: 19 days ago
JSON representation
Accesses the 'ovba' rust library to extract vba binary files
- Host: GitHub
- URL: https://github.com/janmarvin/ovbars
- Owner: JanMarvin
- License: other
- Created: 2024-12-12T12:06:56.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-03-23T21:18:42.000Z (about 1 month ago)
- Last Synced: 2025-03-23T21:29:40.969Z (about 1 month ago)
- Topics: r, r-package, vba
- Language: R
- Homepage: https://janmarvin.github.io/ovbars/
- Size: 18.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# ovbars
[](https://github.com/JanMarvin/ovbars/actions)
[](https://janmarvin.r-universe.dev/ovbars)In the Office Open XML standard, files with the `.xlsm` extension indicate that the workbook contains macros. When loading these files using R packages, the macro code is not directly visible as it is embedded in a file named `vbaProject.bin`.
This R package serves as a wrapper around the `ovba` Rust library, enabling the parsing of the `vbaProject.bin` file. You can extract the `vbaProject.bin` file by unzipping the XLSM file or by using the `openxlsx2` package, as demonstrated in the example below.
```{r}
## an example xlsm file
fl <- "https://janmarvin.github.io/openxlsx-data/gh_issue_416.xlsm"## get the path to the vba file
vba <- openxlsx2::wb_load(fl)$vbaProject## extract the macro code
code <- ovbars::ovbar_out(name = vba)## access the code from "Sheet1"
message(code["Sheet1"])
```This view differs from what you might be accustomed to in spreadsheet software, as it includes additional information typically used internally by the software. Lines starting with `Attribute` are entirely hidden.
Similarly, this project allows the extraction of additional information regarding the file system of the OVBA file.
```{r}
## additional meta information regarding the OVBA file system
ovbars::ovbar_meta(name = vba)
```## Development
```r
# document code
savvy::savvy_update()
devtools::document()
# update vendored packages
rextendr::vendor_pkgs()
```## License
This package is licensed under the MIT license and is based on [`ovba`](https://github.com/tim-weis/ovba) (by Tim Weis; COPYRIGHT 2020-2025), also under the MIT license.