-
Notifications
You must be signed in to change notification settings - Fork 9
Import records from CSV files
Valerie Maher edited this page Apr 13, 2016
·
10 revisions
-
On the same server where your Rails app is running, create a directory to put your CSV and supporting files into. You will pass this directory to the import script, and it will parse all the CSV files it finds within that directory. For supporting files, such as images or audio files, you can organize them into sub-directories if you wish, but it's not necessary.
-
Change directories to the Rails root directory
-
You'll need to know the subdomain of the Press that the imported records will belong to. You can run a rake task to see all the subdomains for all Presses.
bundle exec rake press:list
- If you want to see what options you can pass to the import script, you can run it with
-h
or--help
to see the usage information:
bundle exec script/import --help
- Run the import script, giving it the path to the directory where your CSV files are located, the subdomain of the Press, (and optionally, the visibility that the imported records will have).
bundle exec script/import -d /path/to/directory -p umich -v public