Hi, I guess you are working with wrong syntax;
Please see the below code which can be the solution for your problem. sheetname="X" datatable.AddSheet(sheetName) datatable.ImportSheet "C:\qtp\Datasheet.xls",sheetName,sheetName wait(2) sheetname="Y" datatable.AddSheet(sheetName) datatable.ImportSheet "C:\qtp\Datasheet.xls",sheetName,sheetName Wait(2) sheetname="Z" datatable.AddSheet(sheetName) datatable.ImportSheet "C:\qtp\Datasheet.xls",sheetName,sheetName I have the Datasheet.xls at C:\qtp with sheets x,y,z respectively. Syntax for importing: Datatable.Importsheet Filename,Sourcesheet,Destinationsheet. Thanks, Srinadh On Mon, Aug 10, 2009 at 7:14 AM, Steve <[email protected]> wrote: > > I am trying to import three data sheets from one excel into QTP at > runtime. It imports one fine, but the rest are empty. Here is my code: > > -------------------------------------------------------- > > ''Load multiple datasheets from excel into QTP. > DataTable.AddSheet("Tabs") > DataTable.AddSheet("Navs") > DataTable.AddSheet("Portets") > > DataTable.ImportSheet "\\<local shared drive>\CS_QA QTP Files\Portal > \common.xls", "Tabs", "Portlets_temp" > DataTable.ImportSheet "\\<local shared drive>\CS_QA QTP Files\Portal > \common.xls", "Navs", "Portlets_temp" > DataTable.ImportSheet "\\<local shared drive>\CS_QA QTP Files\Portal > \common.xls", "Portlets", "Portlets_temp" > > ''Function that loads the excel spread sheets that are used for data > input > status = data_Import ("\\<local shared drive>\CS_QA QTP Files\Portal > \common.xls", "Portlets", "Portlets_temp", Parameter("Data_Set"), > rowToUse) > If status = False Then > reporter.ReportEvent micFail,"Data Import","Value Not found in Spread > Sheet" > exitRun > End If > > -------------------------------------------------------- > > The name of my QTP script is Portlets_temp > (That is also the name of Action 1.) > > The function that is called above just grabs the first column value > from the "Portlets" datasheet. > > When I run the script and have up the "Data Table" window to help me > debug my script, I only see data get populated into "Portlets_temp", > yet "Tabs", "Navs" and "Portlets" are empty. I want data to only > appear in "Tabs", "Navs" and "Portlets". > > What am I doing wrong? > Steve > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en -~----------~----~----~----~------~----~------~--~---
