Skip to contents

Reads a Screaming Frog export – either an in-memory data frame or a path to a CSV/Excel file – and returns it with canonical snake_case column names, validated against the schema for export_kind. Header aliases are resolved (e.g. "Address", "URL", and "URI" all map to address), empty strings become NA, and character columns are trimmed.

Usage

sf_read_input(x, export_kind, fields = NULL)

Arguments

x

A data frame, or a path to a Screaming Frog CSV/Excel export.

export_kind

Character, which export is being read. One of sf_contract()$export_kinds: "internal_all", "all_inlinks", or "all_outlinks".

fields

Optional character vector of additional (non-required) fields to retain beyond the schema's required set. Default NULL keeps the schema's standard field order.

Value

A data frame with canonical snake_case columns. The resolved schema is attached as the "sf_schema" attribute, a list of export_kind, columns, aliases, and ignored_columns.

Examples

crawl <- data.frame(
  Address = c("https://example.com/", "https://example.com/a"),
  `Status Code` = c(200, 200),
  check.names = FALSE
)
out <- sf_read_input(crawl, "internal_all")
names(out)
#> [1] "address"     "status_code"
attr(out, "sf_schema")$export_kind
#> [1] "internal_all"