Micro Focus QTP (UFT) Forums
Importing excel not working - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Importing excel not working (/Thread-Importing-excel-not-working)



Importing excel not working - Adam82 - 11-02-2012

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


RE: Importing excel not working - sshukla12 - 11-02-2012

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


RE: Importing excel not working - Adam82 - 11-02-2012

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!


RE: Importing excel not working - Adam82 - 11-02-2012

My excel extenstion is .xlsx so I tried using C:\QTP\Training\Calc\Calc and C:\QTP\Training\Calc/Calc without success


RE: Importing excel not working - Ankesh - 11-02-2012

Please note QTP does not import files in .xlsx format.

Convert it to .xls format and then import.

Regards,
Ankesh


RE: Importing excel not working - sshukla12 - 11-05-2012

Hi,
IF ur file is.xlsx then convert it to .xls it will work.

Regards,
Sankalp


RE: Importing excel not working - Adam82 - 11-05-2012

Yes it worked now. The problem was the .xlsx as you mentioned. Thanks