Video of using my new Python library to import a product, an order, an invoice & a payment via command line into Dolibarr in seconds

Example use: I just ran this script to insert 7000+ categories from the online marketplace Tradera into my Dolibarr installation. It took about 2 minutes.

import dolibarr_library as dl
import csv
dl = dl.Dolibarr_library()
#traderakategorin har id=14 i dolibarr
parent=14
#dit under ska alla in
with open(“data/tradera-kategorier-sv-200727.csv”) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=’,’)
line_count = 0
for row in csv_reader:
if line_count == 0:
print(f’Column names are {", ".join(row)}’)
line_count += 1
else:
ref_ext=row[0]
ext_parent=row[1]
label=row[3]
desc=ext_parent
#test=dl.get_category_id_by_ref_ext(ref_ext)
dl.insert_category(parent, label, ref_ext, desc)
line_count += 1
print(f’Processed {line_count} lines.’)