read_excel_datalake: Read a excel file stored in an AWS S3 bucket.

read_excel_datalakeR Documentation

Read a excel file stored in an AWS S3 bucket.

Description

This function get the specified object from an AWS S3 bucket and reads it using read_excel. It keeps the excel in memory and, therefore, it avoids the unintended consequences of saving the file in the disk.

Usage

read_excel_datalake(s3_path, bucket_name = mfe_datalake_bucket,
  version = NULL, all_sheets = T, sheet = 1, ...)

Arguments

s3_path

The filename of the desired excel in the S3 bucket including the full path

bucket_name

Name of the bucket to connect. By default, it uses the Ministry for the Environment data lake for environmental reporting "mfedlkinput".

version

VersionId of the object key desired. Can be retrieved using get_bucket_version_df

all_sheets

If more than one sheet is present, T = read all sheets into a list, F = default to sheet specified

sheet

The sheet number to extract. Defaults to 1.

...

Other arguments passed to the reading_function

Value

A 'tibble

Examples

## Not run: 
setup_datalake_access()
files <- search_datalake(".x", "land", "2021")$Key
read_excel_datalake(files[2])
read_excel_datalake(files[1], sheet = 2)

## End(Not run)

StatisticsNZ/er.helpers documentation built on Oct. 2, 2023, 7:24 a.m.