Windows Vista Forums

Work with web query file
  1. #1


    Sicay Guest

    Work with web query file

    How can i get data from a iqy file??


    [PS] E:\>dir *.iqy


    Directory: E:\


    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    -a--- 10-May-10 10:07 AM 758 owssvr.iqy


    [PS] E:\>$a = New-Object -ComObject excel.application
    [PS] E:\>$iqy = $a.Workbooks.Open(".\owssvr.iqy")
    Exception calling "Open" with "1" argument(s): "'.\owssvr.iqy' could
    not be found. Check the spelling of the file name,
    and verify that the file location is correct.
    If you are trying to open the file from your list of most recently
    used files on the File menu, make sure that the file
    has not been renamed, moved, or deleted."
    At line:1 char:25
    + $iqy = $a.Workbooks.Open <<<< (".\owssvr.iqy")
    + CategoryInfo : NotSpecified: ( [],
    MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

    [PS] E:\>






      My System SpecsSystem Spec

  2. #2


    PaulChavez Guest

    RE: Work with web query file

    Did you try the fully qualified path to the file? In my experience COM does
    not always handle relative paths correctly.

    -Paul


    "Sicay" wrote:

    > How can i get data from a iqy file??
    >
    >
    > [PS] E:\>dir *.iqy
    >
    >
    > Directory: E:\
    >
    >
    > Mode LastWriteTime Length Name
    > ---- ------------- ------ ----
    > -a--- 10-May-10 10:07 AM 758 owssvr.iqy
    >
    >
    > [PS] E:\>$a = New-Object -ComObject excel.application
    > [PS] E:\>$iqy = $a.Workbooks.Open(".\owssvr.iqy")
    > Exception calling "Open" with "1" argument(s): "'.\owssvr.iqy' could
    > not be found. Check the spelling of the file name,
    > and verify that the file location is correct.
    > If you are trying to open the file from your list of most recently
    > used files on the File menu, make sure that the file
    > has not been renamed, moved, or deleted."
    > At line:1 char:25
    > + $iqy = $a.Workbooks.Open <<<< (".\owssvr.iqy")
    > + CategoryInfo : NotSpecified: ( [],
    > MethodInvocationException
    > + FullyQualifiedErrorId : ComMethodTargetInvocation
    >
    > [PS] E:\>
    >
    >
    >
    > .
    >

      My System SpecsSystem Spec

  3. #3


    Sicay Guest

    Re: Work with web query file

    On May 12, 12:43*am, PaulChavez <PaulCha...@newsgroup>
    wrote:

    > Did you try the fully qualified path to the file? In my experience COM does
    > not always handle relative paths correctly.
    >
    > -Paul
    >
    >
    >
    > "Sicay" wrote:

    > > How can i get data from a iqy file??
    >

    > > [PS] E:\>dir *.iqy
    >

    > > * * Directory: E:\
    >

    > > Mode * * * * * * * *LastWriteTime * * Length Name
    > > ---- * * * * * * * *------------- * * ------ ----
    > > -a--- * * * * 10-May-10 *10:07 AM * * * *758 owssvr.iqy
    >

    > > [PS] E:\>$a = New-Object -ComObject excel.application
    > > [PS] E:\>$iqy = $a.Workbooks.Open(".\owssvr.iqy")
    > > Exception calling "Open" with "1" argument(s): "'.\owssvr.iqy' could
    > > not be found. Check the spelling of the file name,
    > > *and verify that the file location is correct.
    > > If you are trying to open the file from your list of most recently
    > > used files on the File menu, make sure that the file
    > > *has not been renamed, moved, or deleted."
    > > At line:1 char:25
    > > + $iqy = $a.Workbooks.Open <<<< (".\owssvr.iqy")
    > > * * + CategoryInfo * * * * *: NotSpecified: ( [],
    > > MethodInvocationException
    > > * * + FullyQualifiedErrorId : ComMethodTargetInvocation
    >

    > > [PS] E:\>
    >

    > > .- Hide quoted text -
    >
    > - Show quoted text -
    Thank Paul. It worked with full qualified path.

    1 more question:
    http://social.technet.microsoft.com/...a-c0aba0960ed0
    What does this line do ==> $iqy.SaveAs('c:\scripts\output\1-
    RawContacts.csv', 6)

    ..Sicay

      My System SpecsSystem Spec

  4. #4


    PaulChavez Guest

    Re: Work with web query file

    That line saves the workbook in CSV format.

    It uses the SaveAs method of the Workbook COM object:
    http://msdn.microsoft.com/en-us/library/bb214129.aspx

    First paremeter is file to save to, second parameter is file format as
    specified in the XlFileFormat enumeration.
    http://msdn.microsoft.com/en-us/library/bb241279.aspx

    -Paul


    "Sicay" wrote:

    > 1 more question:
    > http://social.technet.microsoft.com/...a-c0aba0960ed0
    > What does this line do ==> $iqy.SaveAs('c:\scripts\output\1-
    > RawContacts.csv', 6)
    >

      My System SpecsSystem Spec

Work with web query file problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read from a txt, query AD, write to an xls file? MattW VB Script 3 28 Jul 2009
extract the necessary rowdata from log/txt file from query eventqu tonycd VB Script 2 29 May 2009
Differences in File Counts (query) aukiman PowerShell 2 31 Jul 2008
split source file into many files with 100 entries each to feedscripts that runs wmi query agains machines Tolli Lowell-Forker (1) PowerShell 2 06 Jun 2008
Query log file - Cisco PIX Firewall JB PowerShell 4 18 Jan 2007