Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing excel not working
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
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
Solved: 11 Years, 3 Months, 3 Weeks ago
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
Solved: 11 Years, 3 Months, 3 Weeks ago
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
Solved: 11 Years, 3 Months, 3 Weeks ago
My excel extenstion is .xlsx so I tried using C:\QTP\Training\Calc\Calc and C:\QTP\Training\Calc/Calc without success
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Please note QTP does not import files in .xlsx format.

Convert it to .xls format and then import.

Regards,
Ankesh
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
IF ur file is.xlsx then convert it to .xls it will work.

Regards,
Sankalp
Reply
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
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 2,941 11-02-2012, 03:36 PM
Last Post: vjjohnson04
  Importing Data from a Database rajeshwar 8 19,474 04-03-2012, 12:23 AM
Last Post: qtp-qa
Smile importing objects and properties to excel sheet sandy.jakhar 2 3,711 03-16-2011, 03:26 PM
Last Post: sandy.jakhar
  Data importing from excel using script vaigundamoorthy 3 3,738 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 3,476 08-04-2008, 04:05 PM
Last Post: nageshpv

Forum Jump:


Users browsing this thread: 1 Guest(s)