Hello Monks! I am writing a script that would refresh the data connections within a few excel files but the refresh command I am using via Win32::OLE module is not working as I had hoped and read online. I have looked quite a bit online on different ways to refresh the data connections, create a macro and run the macro via perl, a prog written in C# specifically to refresh executable via perl, etc. but have not had much luck. I believe the issue is primarily because its Excel 2013, because the machine I have to access the DB has 2013 I can't test my code with an older excel version to be absolute certain. Can you please provide some guidance on how I can successfully refresh data connections in Excel 2013. See below a snippet of my refresh code. Many Thanks in advance!
use strict; use warnings; use Win32::OLE; my $filename = 'C:\refresh_test.xlsx'; my $Excel; $Excel = Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{DisplayAlerts} = "False"; $Excel->{Visible} = 1; my $wb = $Excel->Workbooks->Open($filename); $wb->RefreshAll; $wb->Save; $wb->Close; $Excel->Quit();
In reply to Excel 2013 Data Connection Refresh by sowais
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |