Quantcast
Channel: Quality Center / ALM Practitioners Forum topics
Viewing all articles
Browse latest Browse all 5491

Automatically create Excel Reports and store them using Perl

$
0
0

Hi,

I need to generate an excel report automatically using perl script.

I develop a script and able to get to the analysis folder using AnalysisitemFolderFactory and and to my file containing my query using AnalysisitemFactory but i dont find any clue on how to run the query generate an excel report and save it in my machine.

Here is the code in perl:

#!/usr/bin/perl
use strict;
use warnings; 

use Cwd;
eval 'use Win32::OLE';
use Win32::OLE::Variant;

my $tdc = Win32::OLE->new('TDapiole80.TDconnection');

$tdc->InitConnectionEx("http://cmqcapp1.emulex.com:8080/qcbin");

$tdc->Login("user name","password");
$tdc->Connect("domain name", "project name");

my $Analysis_Folder_factory_filter = $tdc->AnalysisItemFolderFactory->Filter;

foreach my $folder ($Analysis_Folder_factory_filter->NewList){
    for (my $i = 1; $i <= $folder->Count; $i++){
        my $current_value = $folder->Item($i)->Name;
        next if ($current_value ne "Dash_Board_Folder_Name");
        my $folder_items_obj = $folder->Item($i)->AnalysisItemFactory;
        my $folder_items_obj_filter = $folder_items_obj->Filter;

        foreach my $file ($folder_items_obj_filter->NewList){
            for (my $j = 1; $j <= $file->Count; $j++){
                my $sheetName = $file->Item($j)->Name;
                next if ($sheetName ne "Excel File Query_Sheet_Name");
                my $item_id = $file->Item($j)->ID;

                my $filterData = $file->Item($j)->FilterData;
                print $sheetName ;

                # HERE I THINK I NEED TO WRITE SOMETHING THAT WILL EXECUTE QUERY DOWNLOAD THE EXCEL SHEET.
                last;
            }
        }
    }
}

$tdc->Disconnect();
$tdc->Logout();
$tdc->ReleaseConnection();
$tdc->Quit();

 

Already went through the below  almost same link but couldn't find the solution 

http://community.hpe.com/t5/Quality-Center-Support-and-News/Automatically-create-Excel-Reports-and-store-them-in-a-folder/td-p/4406388

 

Please help me in solving this. Looking forward for your suggestions.

Thanks in Advance.


Viewing all articles
Browse latest Browse all 5491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>