Project for creating shipment drafts in Pack LInk Pro using the data stored in Google Sheets, from the project Kofi API
Project type: client
Table of Contents
For use this project, you should have a Kofi API service working, and saving data in a google sheets. You also need a Kofi account (the same as the Kofi API) already logged in your google chrome, and a Pack Link Pro account already logged too.
The project will:
- Get main data from the google sheet.
- Extract the shipping data from kofi details page
- Go to Pack Link Pro Create page
- In the Shipment details page, it will fill the:
- Country
- Zip code
- Weight (if required)
- Length (if required)
- Width (if required)
- Height (if required)
- In the Choose a service page, it will select the first option
- In the Address data page, it will:
- fill the address data with the client user info
- Select the content type
- Set a value (calculated as: product value from google sheet, minus shipment price)
- Select the "Shipment protection" or "I am willing to risk my shipments", based in your settings (more about settings details in the following sections)
- In the Customs page (if is active), it will fill the following data from settings:
- Invoice number
- Category
- Description
- Items made in
- Quantity
- Value (the same as above)
- Weight
- Save the draft
To run the project, the following software must be installed::
- Google Chrome last version
- Python >= 3.10
Install all the python modules from pip:
$ pip install -r requirements.txtIn this file (.env), are the main options and settings of the project.
- Create a .env file, and place the following content
CHROME_FOLDER = C:Users{your-user}AppDataLocalGoogleChromeUser Data
GOOGLE_SHEETS=https://docs.google.com/spreadsheets/d/{some random chars}/edit?pli=1#gid=0
PARCEL_WEIGTH = 1
PARCEL_LENGTH = 10
PARCEL_WIDTH = 10
PARCEL_HEIGHT = 10
CONTENT_SHIPPED = Electronics
RISK_SHIPMENT = True
CUSTOM_CATEGORY = videogames
CUSTOM_DETAILS = Sample text here
CUSTOM_MADE_IN = México
CUSTOM_QUANTITY = 1
CUSTOM_WEIGHT = 1Note: you can see as reference the sample.env file
Path of your google chrome data
By default, in windows C:Users{your-user}AppDataLocalGoogleChromeUser Data
The link of the google sheet where data will be saved, with edit permissions Details about structure and content, in the project Kofi API
PARCEL_WEIGTH, PARCEL_LENGTH, PARCEL_WIDTH and PARCEL_HEIGHT
These are the values to set in the section Parcels from the Shipment details page
The content in the section Content shipped from the page Address data
True for select the I am willing to risk my shipments option, else (for add a protection) save as False
CUSTOM_CATEGORY, CUSTOM_MADE_IN, CUSTOM_QUANTITY, CUSTOM_WEIGHT
Data to write in the items section from the page Customs
*Note: if there are categories with similar names, CUSTOM_CATEGORY can be only a word of the category name (if you write this word manually, the first displayed option should be the correct one).
In the file counters.json, there is the options invoice_number. This is a counter of the orders created and it will be saved in the Customs page.
You can edit it.
{
"invoice_number": 333
}Note: you can see as reference the sample.counters.json file
You should create a credentials file from your Google Console, with the same account owner of the Google Sheets file, to allow connect to it.
- Generate if following this tutorial.
- Download the json file.
- Place in the project folder as
credentials.json
For run the bot, just run with your python interpreter the __main__.py file or the project folder
$ python .$ python __main__.py