01-18-2011, 02:07 PM
Pages: 1 2
01-21-2011, 09:18 AM
hi
QTP 10 doesnt support .xlsx.so,if you try to import .xlsx file,it throws an error,showing invalid file.
thanks
vijaya
QTP 10 doesnt support .xlsx.so,if you try to import .xlsx file,it throws an error,showing invalid file.
thanks
vijaya
02-08-2011, 09:25 AM
Hi All,
I'm also struggling to import an excel file to Datatable. I have an excel by name Sample.xls and my script is as below
Dim qt
Set qt = createobject("QuickTest.Application")
qt.Launch
qt.Visible=True
DataTable.ImportSheet "C:/Users/Desktop/Sample.xls",1,"Global"
I wrote this in expert view of QTP and ran it. When I run it, I'm seeing the Global sheet of DataTable getting populated (I see the values copied to cell quickly), but at the end of the run, there are no values in the DataTable. I also see 5 iterations of the execution, in the HP results view, where as I ran it only once.
Can somebody throw some light on this ?
I'm also struggling to import an excel file to Datatable. I have an excel by name Sample.xls and my script is as below
Dim qt
Set qt = createobject("QuickTest.Application")
qt.Launch
qt.Visible=True
DataTable.ImportSheet "C:/Users/Desktop/Sample.xls",1,"Global"
I wrote this in expert view of QTP and ran it. When I run it, I'm seeing the Global sheet of DataTable getting populated (I see the values copied to cell quickly), but at the end of the run, there are no values in the DataTable. I also see 5 iterations of the execution, in the HP results view, where as I ran it only once.
Can somebody throw some light on this ?
02-21-2011, 08:52 AM
you can save import it as .xls
03-07-2011, 12:24 AM
(09-30-2008 02:19 AM)kishoreinchennai Wrote: [ -> ]Yes it is
The .xlsx format is not supported by QTP 9.5. Try saving the excel 2007 spreadsheet as .xls and do the import
Regards
datatable.ImportSheet"D:\Akbar1.xls",1,1
Try this it is working.....cool
04-12-2011, 11:46 AM
Hi all,
Set oexcel = CreateObject("Excel.Application")
Set obook = oexcel.Workbooks.Open("C:\QTP_Assignment.xlsx","Append")
Set objDriverSheet = obook.Worksheets("Mukesh")
' Writing values into excel sheet
objDriverSheet.Cells(2,5) = "111111111"
objDriverSheet.Cells(3,5) = "22222222"
obook.Save
obook.Close
///////////////////////////////////////////////
when i run this script i get an run error like this
////////////////////////////////////////////////////////
The test run cannot continue due to an unrecoverable error.
Microsoft Office Excel cannot access the file 'C:\76149810'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
////////////////////////////////////////////////////////////////
The data 111111111 and 22222222 was written into the excel sheet.
I think i have to open the file in the append mode as it tries to write a new file with the same name.Can anyone help me how to open the xlsx
file in the append mode
Thanks
Set oexcel = CreateObject("Excel.Application")
Set obook = oexcel.Workbooks.Open("C:\QTP_Assignment.xlsx","Append")
Set objDriverSheet = obook.Worksheets("Mukesh")
' Writing values into excel sheet
objDriverSheet.Cells(2,5) = "111111111"
objDriverSheet.Cells(3,5) = "22222222"
obook.Save
obook.Close
///////////////////////////////////////////////
when i run this script i get an run error like this
////////////////////////////////////////////////////////
The test run cannot continue due to an unrecoverable error.
Microsoft Office Excel cannot access the file 'C:\76149810'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
////////////////////////////////////////////////////////////////
The data 111111111 and 22222222 was written into the excel sheet.
I think i have to open the file in the append mode as it tries to write a new file with the same name.Can anyone help me how to open the xlsx
file in the append mode
Thanks
04-14-2011, 01:20 PM
(02-08-2011 09:25 AM)RGummadidala Wrote: [ -> ]Hi All,
I'm also struggling to import an excel file to Datatable. I have an excel by name Sample.xls and my script is as below
Dim qt
Set qt = createobject("QuickTest.Application")
qt.Launch
qt.Visible=True
DataTable.ImportSheet "C:/Users/Desktop/Sample.xls",1,"Global"
I wrote this in expert view of QTP and ran it. When I run it, I'm seeing the Global sheet of DataTable getting populated (I see the values copied to cell quickly), but at the end of the run, there are no values in the DataTable. I also see 5 iterations of the execution, in the HP results view, where as I ran it only once.
Can somebody throw some light on this ?
Hi,
first of all there is no need to use QTP AOM inside QTP in the expert view. your last statement only should work.Now answer to your question : "at the end of the run, there are no values in the DataTable" - The import you are doing is runtime, so the data which you see will not be visible after the run session. you can see the imported data in the runtime data table. for your second query - as the data is being imported into Global sheet, the test is being iterated to the number of rows in the global sheet. If your test is iterated 5 times then there must be data in 5 rows in the excel you are importing. try importing your data in a new sheet.
hope this solves your query.
@mukesh_shenoy18 - Please open a new thread for your query.
05-25-2011, 08:47 PM
(04-14-2011 01:20 PM)Saket Wrote: [ -> ](02-08-2011 09:25 AM)RGummadidala Wrote: [ -> ]Hi All,
I'm also struggling to import an excel file to Datatable. I have an excel by name Sample.xls and my script is as below
Dim qt
Set qt = createobject("QuickTest.Application")
qt.Launch
qt.Visible=True
DataTable.ImportSheet "C:/Users/Desktop/Sample.xls",1,"Global"
I wrote this in expert view of QTP and ran it. When I run it, I'm seeing the Global sheet of DataTable getting populated (I see the values copied to cell quickly), but at the end of the run, there are no values in the DataTable. I also see 5 iterations of the execution, in the HP results view, where as I ran it only once.
Can somebody throw some light on this ?
Hi,
first of all there is no need to use QTP AOM inside QTP in the expert view. your last statement only should work.Now answer to your question : "at the end of the run, there are no values in the DataTable" - The import you are doing is runtime, so the data which you see will not be visible after the run session. you can see the imported data in the runtime data table. for your second query - as the data is being imported into Global sheet, the test is being iterated to the number of rows in the global sheet. If your test is iterated 5 times then there must be data in 5 rows in the excel you are importing. try importing your data in a new sheet.
hope this solves your query.
@mukesh_shenoy18 - Please open a new thread for your query.
06-25-2011, 05:11 PM
Use Excel 97-2003 Workbook type while saving the excel sheet.
Pages: 1 2
I just saw your post today when I had to ban another spammer on this thread.