Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

How to extract QVD data using python

Is there any way to extract data from QVD file using python script.

**sorry i never worked on qlikview but we have a requirement to extract data from qlikview pertaining to some tool we are building.

Thanks a million in advance.

Tags (1)
7 Replies
avinashelite
Not applicable

Re: How to extract QVD data using python

QVD are native qlik readable file .....it has 3 parts

  • XML header to describe the fields in the table, the layout of the subsequent information and other meta-data.
  • Symbol tables in a byte stuffed format.
  • Actual table data in a bit-stuffed format.

As per I know you could extract the meta-data information not sure about the actual data

Highlighted
marcus_malinow
Not applicable

Re: How to extract QVD data using python

Hi Prabhat,

given that QVD is a proprietary format, you're likely to run into difficulties. You might look instead into saving your data into QVX files, then reading those.

QlikView QVX File Format

https://community.qlik.com/message/92107#92107

Marcus

VasilyEvdokienko
Not applicable

Re: How to extract QVD data using python

Try this:

def qvd_to_pandas(src_qvd):

    from tempfile import TemporaryDirectory
    from pathlib import Path

    from win32com.client import Dispatch
    import pandas as pd

    with TemporaryDirectory(dir='.') as tmp_dir:
        tmp_csv = Path(tmp_dir).absolute() / 'tmp.csv'
        tmp_qvw = Path(tmp_dir).absolute() / 'tmp.qvw'

        script = f'''    
        ExportTable: REPLACE LOAD * FROM {Path(src_qvd).absolute()} (qvd);
        STORE ExportTable INTO {tmp_csv} (txt);
        DROP TABLE ExportTable;
        '''

        qv = Dispatch('QlikTech.QlikView')
        active_doc = qv.CreateDoc()

        doc_properties = active_doc.GetProperties()
        doc_properties.script = doc_properties.script + script

        active_doc.SetProperties(doc_properties)
        active_doc.SaveAs(tmp_qvw)
        active_doc.ReloadEx(0, 1)

        active_doc.CloseDoc()
        qv.Quit()

        df = pd.read_csv(open(tmp_csv, encoding='utf8'), dtype=str)

    return df

df = qvd_to_pandas('my_qvd_file.qvd')
IAMDV
Not applicable

Re: How to extract QVD data using python

VasilyEvdokienko
Not applicable

Re: How to extract QVD data using python

Added attributes to my stackoverflow post. Thanks ;-)
IAMDV
Not applicable

Re: How to extract QVD data using python

Lol! Nice situation to be in. I had a feeling that you are the same person. You see - I didn’t go too hard without knowing it. Smiley Wink

Does this only work on Windows OS? I tried on Mac OS and it doesn’t work.
VasilyEvdokienko
Not applicable

Re: How to extract QVD data using python

Integrity matters :-)
Yes, only works on Windows. For Mac the solution may be in https://github.com/mattneub/appscript