Hi ALL,

I am reading some values from the Excel file by using Win32::OLE,I am able to read all fields bur not able able read if the date is in dd/mm/yy( i.e / slash) .If i am using backward slash then the date is working .Can any body tell me how to read the a date from the EXCEL file


Example  EXCEL file

     TESTERNAME Swayam
     DATE 9/2/2006
     DEVICETYPE SOLARIS
     HARDWAREVERSION vx34.56



if i am reading the file then i am able to get the values of TESTER_NAME,DEVICE_TYPE,HARDWARE_VERSION but it's not able to take the value of DATE. but if i am using backward slash (\) then it's working .

Part  of my code



open (FILE,">>reportfile") or die "can't open $!";

for ($i = 1; $i <=12 ; $i++)
{
   # Skip over empty cells
   if ( (!defined($sheet->Range('A'.$i)->{'Value'}))  )
   {
      next;
   }

   elsif ($sheet->Range('A'.$i)->{'Value'} eq  "TESTERNAME")
   {

print FILE "#" . $sheet->Range('A'.$i)->{'Value'} . " :\t\t" .$sheet->Range('B'.$i)->{'Value'}. "\n";
   }

   elsif ($sheet->Range('A'.$i)->{'Value'} eq  "DATE")
   {
print FILE "#" . $sheet->Range('A'.$i)->{'Value'} ." :\t\t\t" ."$sheet->Range('B'.$i)->{'Value'}"."\n";
   }

   elsif ($sheet->Range('A'.$i)->{'Value'} eq  "DEVICETYPE")
   {
print FILE "#" . $sheet->Range('A'.$i)->{'Value'} . " :\t\t" .$sheet->Range('B'.$i)->{'Value'}. "\n";
   }

   elsif ($sheet->Range('A'.$i)->{'Value'} eq  "HARDWAREVERSION")
   {
print FILE "#" . $sheet->Range('A'.$i)->{'Value'} . " :\t" .$sheet->Range('B'.$i)->{'Value'}. "\n";
   }
}

But the same code is working if in the excel file (which i am reading ) i am using date format as 06\02\2006 ( back ward slash)


Thanks

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to