Friday, September 12, 2014

Searching Excel with iLogic II: Header Rows

A few blogs back, my partner in crime Carl Smith posted about searching Excel with iLogic as a means of gathering data for ever changing projects.  This has come in handy multiple times for me.


I recently had a case where a client had a very nice looking Excel file with data at the top.  This forced the column headers I was searching for down a few rows.  An example is shown to the right.

By default, the GoExcel.FindRow likes the Column that is searching for to be in Row 1 of the worksheet.

This can be changed by using GoExcel.TitleRow.  This will allow you to tell iLogic what row to start looking for column names.

Before your GoExcel.FindRow command, add:

GoExcel.TitleRow = X

Replace the X with the row your Column headings are located in.

Here is what the code section would look like:

GoExcel.TitleRow = 8
i = GoExcel.FindRow("SalesOrders.xlsx", "Header", "Part Number", "=", PartNumber)

Description = GoExcel.CurrentRowValue("Description")
Length = GoExcel.CurrentRowValue("Length")

Randy


"I have not failed. I've just found 10,000 ways that won't work.~Thomas A. Edison


No comments:

Post a Comment