Extract Data From A Specific Row/Column In Table

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
johngreenspan
Posts: 4
Joined: Fri Dec 18, 2009 3:09 pm
Contact:

Extract Data From A Specific Row/Column In Table

Post by johngreenspan » Fri Dec 18, 2009 3:20 pm

I tried to extract 2 pieces of info from a page. This is where it can be found the first time I load the page:

"TAG POS=17 TYPE=B ATTR=TXT:* EXTRACT=TXT
TAG POS=109 TYPE=FONT ATTR=TXT:* EXTRACT=TXT "

But when I load it again, it's found at a different location:

"TAG POS=16 TYPE=B ATTR=TXT:* EXTRACT=TXT
TAG POS=106 TYPE=FONT ATTR=TXT:* EXTRACT=TXT "

These info are always found at a specific location in a table (last column, 2nd row). Is there a way to extract based on position in a table?

Any help is appreciated.
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: Extract Data From A Specific Row/Column In Table

Post by MattBell7 » Mon Dec 21, 2009 9:36 am

User relative tags, rather than absolute.

select the first table cell, using something like

Code: Select all

TAG POS=1 TYPE=TD ATTR=TXT:*
then select the cells you want relative to this cell. You do this by using R1 instead of just 1 in the POS tag.

So

Code: Select all

TAG POS=R17 TYPE=B ATTR=TXT:* EXTRACT=TXT
will select the 17th piece of text from whatever is currently selected.

If the size of the table changes, and you always need the last row, try selecting the first element AFTER the table, then use

Code: Select all

TAG POS=R-1 TYPE=B ATTR=TXT:* EXTRACT=TXT
which will select the first matching tag BEFORE the currently selected item.
johngreenspan
Posts: 4
Joined: Fri Dec 18, 2009 3:09 pm
Contact:

Re: Extract Data From A Specific Row/Column In Table

Post by johngreenspan » Thu Dec 24, 2009 6:30 am

Wow...I didn't know we can do this. =)

For the info that I need to extract, the table sometimes presents itself in 2 columns, sometimes 3. Since the relative position is uncertain, how do I extract the last column, 2nd row's information with your method?
Post Reply