description |
---|
Get your Google sheet into your Database |
Upload does what it says on the tin, it uploads a google sheet to your database.
Sheetwork prefers to be ran from the folder where your sheetwork_project.yml
file resides. We'll touch on another way to do that in a later section but for now:
- open a terminal window
- activate the virtual environment in which you have set up sheetwork
- navigate to your sheetwork project folder
cd ~/my_sheetwork_project
Then follow one of the methods below that fits your needs and setup.
If you have not configured your sheet in a sheets.yml
file you'll have to construct the following command:
sheetwork upload --sheet-key <google_sheet_key> --schema sandbox --table my_table --create-table
Nice! We like to think this is the best way to experience the full potential of sheetwork. When you have your sheet configured the upload
operation isn't that much different from the one shown above. If you have set always_create_table: true
in your sheetwork_project.yml file your call could be as simple as that.
sheetwork upload --sheet-name my_google_sheet
If you want to override any of the sheet.yml configuration such as target schema, whether to create your objects etc you can use the following CLI arguments.
{% hint style="danger" %} This is not the preferred way to run Sheetwork. You will have to make sure you are referring to the right directories and be able to understand potentially strange error messages. {% endhint %}
Although this is not the preferred usage, you might want the option of running sheetwork from anywhere on your disk. This comes in handy if you're running upload jobs on a scheduler machine and you do not want to complicate your job call with cd <your_sheeload_project>
type of calls.
You can use directory flags and provide paths to the set of necessary files for sheetwork.
--sheet-config-dir
: absolute path pointing to yoursheets.yml
--profile-dir
: absolute path pointing to yourprofiles.yml
file.--project-dir
: absolute path pointing to yoursheetwork_project.yml
file
sheetwork upload --sheet-name test_sheet --sheet-configdir /path/to/sheet_config