Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data importing from excel using script
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi ,

I needto enter the username, password value from external excel sheet by using script.
Howcan i write the script for this condition

A B
Username Password
tutorial tutorial
abc cde
12345 12345

I did something
Code:
set objExe= createobject("Excel.Application")
Set a=objExe.workbooks.open("     ")
Set b=a.worksheets("sheet1")


IT would be great if anyone suggests how do i write?
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Code:
Set objXL = CreateObject("Excel.Application")
    objXL.Application.visible = true
    Set objWB = objXL.WorkBooks.Open(filePath)
    Set objWS = objXL.ActiveWorkBook.WorkSheets(workSheetName)
    'how many rows are used in the current worksheet
    rCount = objWS.UsedRange.Rows.Count
    
   'Considering u know the column number
    For row = 1 To rCount
          MsgBox objWS.Cells(row,column).Value
    Next
    objXL.Quit
    Set objXL = Nothing
    Set objWB = Nothing
    Set objWS = Nothing
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Code:
dim xl
set xl=createobject("excel.application")

xl.workbooks.open "D:\Documents and Settings\320003992\Desktop\New Microsoft Excel Worksheet.xls"
xl.visible=true
xl.sheets("Sheet1").select

rc=xl.activeworkbook.sheets("Sheet1").usedrange.rows.count
msgbox rc

for i=1 to rc

a=xl.cells(i,"A").value
msgbox a
b=xl.cells(i,"B").value
msgbox b

next

xl.activeworkbook.save
xl.quit
set xl=nothing
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
This was excellent piece of code.Thanks very much.Hope my problem is solved.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Search and import data from excel under some rules. nwpulele 2 2,970 02-19-2015, 04:10 AM
Last Post: supputuri
  Excel and Driver Script shipu 1 3,862 02-27-2014, 09:09 AM
Last Post: supputuri
Question QTP Script for enter data to DB geethu105 2 3,338 02-24-2014, 06:54 PM
Last Post: guin.anirban
  How to populate data in weblist using excel vijifun 1 3,350 12-05-2013, 12:06 PM
Last Post: basanth27
  VB SCRIPT to click on specific links on webpage and store related data ACCBAJPA 1 10,033 04-02-2013, 01:33 PM
Last Post: ACCBAJPA

Forum Jump:


Users browsing this thread: 1 Guest(s)