convert_to_xlsx: Convert a File to XLSX Format Natively in Excel

View source: R/convert_to_xlsx.R

convert_to_xlsxR Documentation

Convert a File to XLSX Format Natively in Excel

Description

convert_to_xlsx() converts a given file to XLSX format using Excel's "Save As" functionality. This replicates the output you'd get if you opened the file and saved it manually.

Usage

convert_to_xlsx(file, xlsx_file = NULL)

Arguments

file

The path to a file readable by Excel

xlsx_file

The path to the new xlsx file. The default only changes the extension of file to '.xlsx'. Note: if xlsx_file does not end in '.xlsx', the current extension (if any) will be dropped and '.xlsx' will be appended to the path.

Details

This function solves the inverse problem of Excel's (in)famous changing of data types; if your pipeline was built around Excel, you actually need to consistently treat the data as Excel would, whether working interactively in Excel or programmatically in R. There's no way of doing this natively in R (or any other language); convert_to_xlsx() creates and runs a temporary VBA script that interfaces with Excel programmatically.

If you're starting a data pipeline from scratch, please don't use this function. Just avoid Excel.

Value

xlsx_file, as a tidy path (invisibly)


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.