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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.