Take a look at the switch call. That's basically it. Returns an appropriate function or throws an error if wasn't able to find one.
cloud_guess_read_fun(file)A reading function.
Path to a file relative to project folder root. Can contain only letters, digits, '-', '_', '.', spaces and '/' symbols.
Here's how we identify a reading function based on file extension
.csv: readr::read_csv
.json: jsonlite::read_json
.rds: base::readRDS
.sav: haven::read_sav
.xls: cloud_read_excel
.xlsx: cloud_read_excel
.xml: xml2::read_xml