Here is an example of opening an Excel file and looping through rows
and colums:

                        # Get data from start.xls based on computername
                        application = WIN32OLE.new('Excel.Application')
                        if (File.exists?('V:\\QA\\WTM\\WTM.rb'))
                                worksheet = 
application.Workbooks.Open('V:\\QA\\WTM\
\start.xls').Worksheets('URL\'s')
                        else
                                worksheet = 
application.Workbooks.Open('C:\\QA\\WTM\
\start.xls').Worksheets('URL\'s')
                        end
                        worksheet.Activate

                        # Get country and language settings
                        contLoop = true
                        row = 1
                        while contLoop do
                                colVal = worksheet.Cells(row, 1).Value
                                if (colVal) then
                                        if (colVal == strUser) then
                                                country = worksheet.Cells(row, 
4).Value
                                                
self.setEnvironment(worksheet.Cells(row, 2).Value)
                                                
self.setLanguage(worksheet.Cells(row, 3).Value)
                                                
self.setCountry(worksheet.Cells(row, 4).Value)
                                                
self.setBrowserType(worksheet.Cells(row, 5).Value)
                                        end
                                else
                                        contLoop = false
                                end
                                row +=  1
                        end

                        # Get catalog information
                        contLoop = true
                        row = 28
                        while contLoop do
                                colVal = worksheet.Cells(row, 4).Value
                                if (colVal) then
                                        if (colVal == country) then
                                                if (worksheet.Cells(row, 
8).Value != nil)
                                                        
self.setCategory(worksheet.Cells(row, 8).Value)
                                                else
                                                        
self.setCategory('TELEVISIONS')
                                                end
                                        end
                                else
                                        contLoop = false
                                end
                                row = row + 1
                        end

                        application.ActiveWorkbook.Save
                        application.Workbooks.Close
                        application.quit

On Jan 24, 9:52 am, malar b <[email protected]> wrote:
> hi,
> i need to read data from an excel sheet and substitute those data into
> text_field's in a web page.
> My excel data will be like this,for Example
>
> ID           Name
> 1            John
> 2            jerry
> 3            malar
>
> Do u anyone know the coding?
>
> Thanks
> Malar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to