This tool automates submitting purchase requests on Callink using Selenium. Using the Reimbursement Submission Form response spreadsheet, it retrieves ALL Stage 0 purchase requests and puts them all in Stage 1 on Callink.
You must be a Stage 2 Financial Requester/Agent for the club in order to use this script.
- Run
pip install -r requirements.txtto install all necessary dependencies.
- Go to Google Sheets API Python Quickstart and complete Step 1.
- If asked to configure your OAuth client, select
Desktop App. - Click
DOWNLOAD CLIENT CONFIGURATIONand put the downloadedcredentials.jsoninto/anova_finance.
Since Selenium always opens up a new instance of the browser, you want to save your Berkeley login into a cookie so you don't have to sign in each time you run the script.
- Open Google Chrome and log in to your Berkeley email.
- In a new tab, go to
chrome://versionand copy your Profile Path. On Mac, it should look something like:/Users/name/.../Google/Chrome/Default - In
submission.py, paste your profile path as a string toPROFILE_PATH.
We'll create a separate file to store the SPREADSHEET_ID of the Reimbursement Submission spreadsheet so that it is not in plain text on GitHub. This file should never be pushed or committed.
- Create a file called
secrets.py. - On the Reimbursement Submission spreadsheet, copy the spreadsheet id by going to its link. The spreadsheet ID looks like a hash in the link:
https://docs.google.com/spreadsheets/d/{spreadsheet_id}/edit - In
secrets.py, setSPREADSHEET_ID = 'spreadsheet_id'. Make sureSPREADSHEET_IDis a string. - Exit Google Chrome.
Currently, the script submits all purchase requests that have not been submitted yet (in Stage 0). This is based on the Reimbursement Submission Google Form responses. All purchase requests are in Stage 0 until it is submitted on Callink.
- MAKE SURE YOU ClOSE ANY OPEN CHROME WINDOWS OR THE SCRIPT WILL NOT WORK!
- On the command line, make sure you are in the root directory of this project:
/anova_finance. - Run
python submission.py
Google Chrome should automatically open and visit ANova's finance page on Callink. Do not click anything — the script will automatically fill in the values of the required fields on the Purchase Request Form based on the responses of the Reimbursement Submission Form response spreadsheet and submit them one-by-one.
And that's it! Happy financing.