% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/catalog.R
\name{ato_download}
\alias{ato_download}
\title{Download a resource from an ATO dataset}
\usage{
ato_download(
  id,
  pattern = NULL,
  parse = c("auto", "csv", "xlsx", "none"),
  sheet = 1
)
}
\arguments{
\item{id}{CKAN package id (e.g. \code{"taxation-statistics-2022-23"}
or \code{"corporate-transparency"}).}

\item{pattern}{Optional regex applied to the resource filename
and name.}

\item{parse}{One of \code{"auto"} (default), \code{"csv"}, \code{"xlsx"}, or
\code{"none"} (returns the cached file path).}

\item{sheet}{For XLSX resources: sheet index or name.}
}
\value{
Either a file path (\code{parse = "none"}) or an \code{ato_tbl}.
}
\description{
Low-level helper for arbitrary CKAN resources. Resolves the
package by id (slug) and picks the first resource matching
\code{pattern}, or the first resource if \code{pattern} is \code{NULL}.
}
\examples{
\donttest{
op <- options(ato.cache_dir = tempdir())
try({
  cat <- ato_download("corporate-transparency",
                      pattern = "2023",
                      parse = "csv")
})
options(op)
}
}
\seealso{
Other discovery: 
\code{\link{ato_catalog}()},
\code{\link{ato_charities}()},
\code{\link{ato_cite}()},
\code{\link{ato_excise}()},
\code{\link{ato_fbt}()},
\code{\link{ato_help}()},
\code{\link{ato_irpd}()},
\code{\link{ato_payg}()},
\code{\link{ato_rdti}()},
\code{\link{ato_sme_benchmarks}()},
\code{\link{ato_tax_gaps}()},
\code{\link{ato_top_taxpayers}()},
\code{\link{ato_vttc}()}
}
\concept{discovery}
