Extract Table / Extract Tag Examples and Understanding Need

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
DAY3
Newbie
Posts: 7
Joined: Mon Nov 28, 2011 5:46 pm
Location: Atlanta, Georgia USA

Extract Table / Extract Tag Examples and Understanding Need

Post by DAY3 » Mon Nov 28, 2011 7:16 pm

First, I absolutely Love the power and brilliance of this Macro Scheduler! Thank you! :P

As I learn more and more how to automate tasks and extract useful data from the web, I have run into a snag. I think that my solution can be found in the new functions, ExtractTable or ExtractTag. But I am finding almost no examples on proper syntax or how to use them. I'm almost positive that I'm not the only one who would love to see the examples I am seeking. Please help me or guide me to where they may be hidden.
I am attempting to build and regularly update a database table from a web published table.

On this Forum, Post: Tue Nov 01, 2011 8:26 am to Forum user:"tjorgens", Marcus gave a fantastic code example of how ExtractTable handily pulls the Version_Matrix data to a csv file. However my web matrix/table is built differently.

The individual columns are in their own tag like this abbreviated example of two columns. (The actual web table is 6 columns wide and hundreds of records deep.)

Code: Select all


<table id="Table3" width="100%" cellspacing="5" cellpadding="2" border="0" style="font-size:small">
	<tr>
		<td id="tdFileNum" style="width:12%">53089010<br><br><br>53094310<br><br><br>53094410<br><br><br>53096110<br><br><br>5261111<br><br><br>52193908<br><br><br>5163511<br><br><br>5164911<br><br><br>5170611<br><br><br>5193411<br><br><br></td>
		<td id="tdSaleDate" style="width:10%">12/06/2011<br><br><br>12/06/2011<br><br><br>12/06/2011<br><br><br>12/06/2011<br><br><br>12/06/2011<br><br><br>12/06/2011<br><br><br>12/06/2011<br><br><br>12/06/2011<br><br><br>12/06/2011<br><br><br>12/06/2011<br><br><br></td>
My current efforts of using IE_ExtractTag puts the entire column string into one field. I have also attempted to use ExtractTable and ExtractTableByName, but the syntax is not clear. :cry:

What is the best way to extract this data while preserving the columns and integrity of records to each other? :?

.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Dec 16, 2011 3:15 pm

Here's an example of ExtractTable:

http://www.mjtnet.com/forum/viewtopic.php?t=7085
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

DAY3
Newbie
Posts: 7
Joined: Mon Nov 28, 2011 5:46 pm
Location: Atlanta, Georgia USA

Thanks for responding Marcus, BUT…

Post by DAY3 » Wed Jan 04, 2012 3:24 am

Thanks for responding Marcus, BUT…

The wonderful example you give here is exactly the one I referred to in my post in the 3rd paragraph above which does not work for my table. Please share some experience you may have with the table structure that I describe above.

BTW, I haven’t logged in here for the past 2 months because I was thinking that the system would email me if someone responded. I never saw one. Now I will check in much more often. I feel certain that I’m not the only one who would love to see more examples of these great extract functions.

Thanks!
David

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Feb 03, 2012 9:31 am

What you will need to do is use ExtractTable and then parse each value to spit out the "columns" by the br delimiters, or use ExtractTag with the HTML setting and parse each TD individually. Basically this table has ONE column with values separated by spaces using the BR tag. So you can parse it based on that. I would probably use ExtractTag or IEGetTags and then parse the extracted html with RegEx.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

DAY3
Newbie
Posts: 7
Joined: Mon Nov 28, 2011 5:46 pm
Location: Atlanta, Georgia USA

Post by DAY3 » Tue Mar 20, 2012 2:11 am

For the casual reader of this post thread:
With Marcus’ hints, I have perfected the extraction of these tables, but it’s not as simple as I first thought. I am using a loop to rotate incremental tag numbers/names across the table, then after each row I am building a CSV string to write to an open wordpad. At the end of the data, I am naming and saving the text file and moving on to the next set of data, ultimately building a folder with dozens of CSV files with many hundreds of records in each. Across many websites with slightly varying data tags and styles, this macro effectively reduces many man hours of focused work down to about 15 minutes at the push of a button. Absolutely beautiful!!! :D

My biggest advise: After figuring out IE_ExtractTagByName was to learn how to use the “waitâ€

raghavaceg
Newbie
Posts: 1
Joined: Tue Oct 15, 2013 9:08 am

Post by raghavaceg » Tue Oct 15, 2013 9:33 am

Hi DAY 3 .. can you please provide the code for your work it would really help..

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts