Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing excel not working
#1
Hi all

I have a problem importing my excel sheets into QTP datatabels, here is my code:

Code:
xlPath = "C:\QTP\Training\Calc\Calc.xls" xlSheet = "Blad1" datatable.AddSheet ("TestData") datatable.ImportSheet xlPath, xlSheet, "TestData"

I get this error message for the last line:
A general error occurred while importing sheet TestData from file C:\QTP\Training\Calc\Calc.xls to sheet Blad1.

Line (18): "datatable.ImportSheet xlPath, xlSheet, "TestData""

The strange thing is that i'm trying to import xlSheet to TestData not the way around as said in the error message!

P.S. the path to the excel file is correct
Reply
#2
Hi,

U want to import the data of worksheet "Blad1", just crosscheck whether this the same name without and space in excel also.

Regards,
Sankalp
Reply
#3
Hi Sankalp

Thanks for the reply. Yes I did and everything seems to be correct. I tried creating an object for this excel and read the cells from it and everything seemed to be working well but when I try to import it I get this error message!
Reply
#4
My excel extenstion is .xlsx so I tried using C:\QTP\Training\Calc\Calc and C:\QTP\Training\Calc/Calc without success
Reply
#5
Please note QTP does not import files in .xlsx format.

Convert it to .xls format and then import.

Regards,
Ankesh
Reply
#6
Hi,
IF ur file is.xlsx then convert it to .xls it will work.

Regards,
Sankalp
Reply
#7
Yes it worked now. The problem was the .xlsx as you mentioned. Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Automate the working of an macro in excel RitaG 1 3,351 11-02-2012, 03:36 PM
Last Post: vjjohnson04
  Importing Data from a Database rajeshwar 8 20,947 04-03-2012, 12:23 AM
Last Post: qtp-qa
Smile importing objects and properties to excel sheet sandy.jakhar 2 4,179 03-16-2011, 03:26 PM
Last Post: sandy.jakhar
  Data importing from excel using script vaigundamoorthy 3 4,437 05-19-2009, 04:53 PM
Last Post: lit_73
  Set the column header in the excelsheet before importing it to local datasheet nageshpv 2 4,078 08-04-2008, 04:05 PM
Last Post: nageshpv

Forum Jump:


Users browsing this thread: 1 Guest(s)