vCard QR code using Libre Office

Hi, is there any method to create a vCard QR code using Calc? As in, fill the columns with Name, Address, email, phone number, WhatsApp etc and get QR code for the same? Thanks.

I am using Ubuntu 22.04. I have Windows 10 as well if required.

In Ubuntu and Python is trivial.

sudo apt install libreoffice-script-provider-python
sudo apt install python3-pip
pip install --user segno
mkdir -p ~/.config/libreoffice/4/user/Scripts/python
vim ~/.config/libreoffice/4/user/Scripts/python/

In copy and paste:

import uno
from segno import helpers

def main():
    path = '/home/mau/my-vcard.svg'
    doc = XSCRIPTCONTEXT.getDocument()
    selection = doc.CurrentController.Selection
    data = {row[0]: row[1] for row in selection.DataArray}
    qrcode = helpers.make_vcard(**data), scale=4)

The field names should be exactly that vCard standar, see:
And all data should be like text.

Select range…

And execute macro Tools… Run macro.

Good luck



data = dict(selection.DataArray)

@elmau, thank you! I see very similar functionality for 1D barcodes available using python-barcode. And I need 1D barcodes right now. python-barcode uses Pillow for image creation. Before going down that rabbit hole, I thought I’d see if you know:

Is there a way to take the return from a call to create a new graphic in pillow (PIL.Image.Image object?) and add it directly to the current ODS as an image, rather than save it to an external file then load it back?

Yes, is possible.
You only need Pillow, if you want image in others formats than SVG.
Please, open new ask and I answer you in that.