Learn R Programming

tab2xml (version 1.1.0)

sheet2xml: Convert a Spreadsheet to XML

Description

It reads a spreadsheet file (Excel or ODS), processes it using a provided XML template, and generates an XML output file.

Usage

sheet2xml(file_path, template_path, xml_path = NULL, optimize = FALSE)

Value

Character. The file path of the generated XML document.

Arguments

file_path

Character. Path to the spreadsheet file to be converted. Supports Excel (.xlsx) and ODS formats.

template_path

Character. Path to the XML template file to guide the transformation process.

xml_path

Character (optional). Output path for the generated XML file. If NULL, it is considered an XML file with the same name and location as the spreadsheet file.

optimize

Boolean. Remove empty nodes from the xml file.

Examples

Run this code
source_xml <- system.file("extdata", "schema_template.xml", package = "tab2xml")

source_xlsx <- system.file("extdata", "schema.xlsx", package = "tab2xml")
temp_file1 <- tempfile(fileext = ".xml")
sheet2xml(source_xlsx, source_xml, temp_file1)

source_ods <- system.file("extdata", "schema.ods", package = "tab2xml")
temp_file2 <- tempfile(fileext = ".xml")
sheet2xml(source_ods, source_xml, temp_file2)

Run the code above in your browser using DataLab