Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This forum is where any logged-in member can create a knowledge article.
Long time ago I have developed a vbscript application to open qlikview, reduce some data according salesman filter, export the sales pivot table to excel and send an email with the excel sheet attached to the salesman using the blat.exe application. The other day i was wondering if the same job could be executed using python. So after two minutes i was googling in search of some code snippets to easily make the python script. After half an hour I was quite disappointed to not found anything already made so I opened Pycharm and started to make the basic code: a class to make an instance of qlikview, open the document, export the table, close the document, close the qlikview app.
Here the code tested on python 3.7:
from win32com.client import Dispatch
import pythoncom
class QlikView:
def __init__(self):
self.app = Dispatch('QlikTech.QlikView')
def OpenDoc(self, docname):
doc = self.app.OpenDoc(docname)
return doc
def CloseDoc(self, doc):
doc.CloseDoc()
def ManageDocument():
docname = "c:\EXAMPLE.qvw"
q = QlikView()
version = q.app.QvVersion()
print(version)
doc = q.OpenDoc(docname)
chart = doc.GetSheetObject("exampletable")
chart.ExportBiff("c:\exampletable.xls"
q.CloseDoc(doc)
q.app.Quit()
if __name__ == '__main__':
ManageDocument()
This is the code that I've written at today , for sure i will go on and rewrite all the app to send report attached in emails, if someone need more information, just send me a message.