I need to import some QVD files to work with them in python using pandas. Does anyone knows if its possible to import qvd files as a dataframe in a jupyter notebook for python2 ?
I need to import some QVD files to work with them in python using pandas. Does anyone knows if its possible to import qvd files as a dataframe in a jupyter notebook for python2 ?
It seems that there is a python package developed this year(2021) https://pypi.org/project/qvd/ maybe can help. I will test by my side.
No, you can't, see http://help.qlik.com/en-US/sense/September2017/Subsystems/Hub/Content/Scripting/work-with-QVD-files.htm
A QVD (QlikView Data) file is a file containing a table of data exported from Qlik Sense. QVD is a native Qlik format and can only be written to and read by Qlik Sense or QlikView.
This may help:
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')
Copied from: https://community.qlik.com/t5/New-to-QlikView/How-to-extract-QVD-data-using-python/td-p/1398020