Power Query Python (Openpyxl) Refresh on Open
I have an excel file that uses a power query connection. I have written a script in python using openpyxl to access that file, find any new data that has been added, and place that data into a different file.
My question is this: If I set the query properties to ‘Refresh data when opening the file’, will using openpyxl to access and ‘load’ the workbook trigger this refresh?
I am not sure how Excel defines the file being opened, because the script does not actually ‘open’ the file on my computer (like, I can’t see it open in my task bar), but I need the data to refresh every time the script runs.
Then, if openpyxl access does not trigger the refresh, how might I achieve something like that? Would Windows Task Scheduler opening the file manage to do that? Thanks for any help, and happy to provide some snippets of code if needed, although I think this is more of a question about Excel’s properties than it is about the actual code.
I have an excel file that uses a power query connection. I have written a script in python using openpyxl to access that file, find any new data that has been added, and place that data into a different file.My question is this: If I set the query properties to ‘Refresh data when opening the file’, will using openpyxl to access and ‘load’ the workbook trigger this refresh?I am not sure how Excel defines the file being opened, because the script does not actually ‘open’ the file on my computer (like, I can’t see it open in my task bar), but I need the data to refresh every time the script runs.Then, if openpyxl access does not trigger the refresh, how might I achieve something like that? Would Windows Task Scheduler opening the file manage to do that? Thanks for any help, and happy to provide some snippets of code if needed, although I think this is more of a question about Excel’s properties than it is about the actual code. Read More