Dataiku Automation For Excel File Refresh

AliTaghiyev
AliTaghiyev Registered Posts: 3

Hello,

I have an excel file which is connected to SQL DWH. Normally everyday, I go in this file to refresh data manually by clicking ctrl + alt + f5. I want to make it automatically with Dataiku.

pip install pywin32
import win32com.client as win32
def refresh_excel_file(file_path):
# Open Excel
excel = win32.Dispatch("Excel.Application")
excel.Visible = False # Keep Excel in the background # Open the workbook
workbook = excel.Workbooks.Open(file_path)

# Refresh all data connections
workbook.RefreshAll()

# Wait for the refresh to finish
excel.CalculateUntilAsyncQueriesDone()

# Save and close
workbook.Save()
workbook.Close()

# Quit Excel
excel.Quit() #Path to your Excel file file_path = 'XXX'
refresh_excel_file(file_path)

Is it possible to make dataiku to run excel application as given above?

As far as I understand

Automating the refresh of an Excel file with data connections using pywin32 relies on automating the Excel application through COM interfaces, which requires a Windows environment with Excel installed. And It is not possible to execute application with Dataiku to automate like this.


If not could you please direct me how i can do this task?

Answers

Setup Info
    Tags
      Help me…