Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set the column header in the excelsheet before importing it to local datasheet
#1
Solved: 10 Years, 9 Months ago
Hi,

I need to set the column header of the excel sheet before importing it in to the QTP local datatable.
Please let me know how to do it.
Thanks.
Reply
#2
Solved: 10 Years, 9 Months ago
Try adding your columns names using the below code to your Data Sheets.


Code:
DataTable.AddSheet "DBOutput"
arrHeader = Array("Col1", "Col2", "Col3", "Col4")

    For each s in arrHeader
            DataTable.GetSheet ("DBOutput").AddParameter  s, ""              
            Next
Reply
#3
Solved: 10 Years, 9 Months ago
Hi thanks, i found the solution.

Code:
Set ExcelObj =  CreateObject("Excel.Application")
ExcelObj.Workbooks.Add
Set NewSheet = ExcelObj.Sheets.Item(1)
NewSheet.Name = "CTO"
NewSheet.Cells(1,1).Value = "Sno"
NewSheet.Cells(1,2).Value = "C1"
NewSheet.Cells(1,3).Value = "O1"
ExcelObj.ActiveWorkbook.SaveAs "C:\CTO_TD.xls"
' close the application and clean the object
ExcelObj.Quit
Set ExcelObj = Nothing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  export UFT datasheet to excel and then append Mozza 0 1,648 09-04-2018, 08:58 AM
Last Post: Mozza
  to count the number of used rows in a particular column sujaravi123 3 10,913 06-12-2013, 03:17 PM
Last Post: sujaravi123
  Importing excel not working Adam82 6 13,151 11-05-2012, 05:22 PM
Last Post: Adam82
  GetRowWithCellText does not work if the header has a colspan ConstantChange 6 7,104 05-08-2012, 04:19 PM
Last Post: Mahmoud.Karam
  How to recognize table row and column siwani 4 4,801 04-05-2012, 05:06 PM
Last Post: verma.vik6

Forum Jump:


Users browsing this thread: 1 Guest(s)