Creating a single data frame from a folder of similarly structure Excel spreadsheets.
Like Voltron-ing your data
bulk_excel(folder=“DEFAULTBULKCSV2017”, export=“filenamedefaultbulkcsv2017.xls”)
folder
- The folder in relation to your working directory where the Excel files exist. Default folder is the current working directory.export
- File name to export CSV file (Not as an Excel file, sorry) as, if wanted.This package is based on readxl, so passing on variables from read_excel
will work in bulk_excel
. These variables will apply to the import of each Excel spreadsheet.
In this example, these Excel spreadsheets reside in a folder called state_data.
The data structure must be similar for each data set, as in column names and data types within the columns are consistent.
Or the bulk join will not work.
To create a new dataframe with all the data sets combined, the command would be:
combined_data <- bulk_excel(folder="state_data")
To simply export the data as a new combined CSV file, the command would be:
bulk_excel(folder="state_data", export="combined_data.csv")
This would save the file to the current working directory.
You can specify the location to download in export
as long as you put the folder structure before the CSV file name, like:
bulk_excel(folder="state_data", export="data_export/combined_data.csv")