Extracting a web table into Excel columns

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Extracting a web table into Excel columns

by bernardgbailey on Wed Jun 29, 2016 6:58 pm

Hi team,

1. What version of iMacros are you using? iMacros Browser v11.1.495.5175 [Trial Version day 1 of 30] (very new :-))
2. What operating system are you using? Windows 10 English 64Bit
3. Which browser(s) are you using? (include version numbers) IE 11.420...

I have been able to extract a table from a webpage and save it to a .csv file.

However when the saved files is opened in notepad, this is what is i get between the ................. lines
.............................................................................................

Vehicle

Vehicle Type

Tier 4

Tier 3

Tier 2

Tier 1

Vehicle Time Zone

Last Attempted Connection

Last Completed Connection

Days Since Last Completed Connection

6118 (1000544)Hyster H18.00XMKawerauCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington30-June-2016 10:51:1530-June-2016 10:51:381 days
5973 (1000739)Hyster H3.5FTTokoroaCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington20-January-2016 23:46:4620-January-2016 23:47:09162 days
5978 (1000771)Hyster H4.0FTTokoroaCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington27-June-2016 14:08:0527-June-2016 14:08:223 days
6132 (1000838)Hyster H12.00XMNelsonCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington30-June-2016 09:20:4130-June-2016 09:21:311 days
5984 (1001004)Hyster H8.0FTHubCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington30-June-2016 10:18:3630-June-2016 10:18:481 days
5983 (1001005)Hyster H8.00FTHubCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington29-June-2016 10:39:5029-June-2016 10:40:292 days
6125 (1001107)Hyster H12.00XMNelsonCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington29-June-2016 14:39:1329-June-2016 14:39:311 days
...................................................................................

The relevant imacro script lines are:

URL GOTO=http://203.xx.xxx.xxx/Fleet_Online/reports/WebReports/NetworkConnectivity.aspx
TAG POS=3 TYPE=TBODY ATTR=* EXTRACT=TXT

'The SAVEAS statement was added manually to write the extracted table to a file
'(The alternative way to get the extracted data is the Scripting Interface)
SAVEAS TYPE=EXTRACT FOLDER=C:\Downloads FILE=Connectivity_{{!NOW:yymmdd_hhnnss}}.csv

'WAIT SECONDS=2
URL GOTO=http://demo.imacros.net/Automate/OK

.................................................................................................

The first 10 text rows are a single row of column headings.
The rest are the elements which go in the columns

I have searched for some time to find out why I cannot get comma and quotes delimited data being saved to the .csv file.

Can you please advise what I am doing wrong here.

Any assistance is much appreciated.

Cheers
Bernard
bernardgbailey
 
Posts: 1
Joined: Thu May 19, 2016 3:02 pm

Re: Extracting a web table into Excel columns

by chivracq on Wed Jun 29, 2016 7:12 pm

bernardgbailey wrote:Hi team,

1. What version of iMacros are you using? iMacros Browser v11.1.495.5175 [Trial Version day 1 of 30] (very new :-))
2. What operating system are you using? Windows 10 English 64Bit
3. Which browser(s) are you using? (include version numbers) IE 11.420...

I have been able to extract a table from a webpage and save it to a .csv file.

However when the saved files is opened in notepad, this is what is i get between the ................. lines
.............................................................................................

Vehicle

Vehicle Type

Tier 4

Tier 3

Tier 2

Tier 1

Vehicle Time Zone

Last Attempted Connection

Last Completed Connection

Days Since Last Completed Connection

6118 (1000544)Hyster H18.00XMKawerauCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington30-June-2016 10:51:1530-June-2016 10:51:381 days
5973 (1000739)Hyster H3.5FTTokoroaCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington20-January-2016 23:46:4620-January-2016 23:47:09162 days
5978 (1000771)Hyster H4.0FTTokoroaCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington27-June-2016 14:08:0527-June-2016 14:08:223 days
6132 (1000838)Hyster H12.00XMNelsonCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington30-June-2016 09:20:4130-June-2016 09:21:311 days
5984 (1001004)Hyster H8.0FTHubCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington30-June-2016 10:18:3630-June-2016 10:18:481 days
5983 (1001005)Hyster H8.00FTHubCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington29-June-2016 10:39:5029-June-2016 10:40:292 days
6125 (1001107)Hyster H12.00XMNelsonCWPGroupIMHYAP(GMT+12:00) Auckland, Wellington29-June-2016 14:39:1329-June-2016 14:39:311 days
...................................................................................

The relevant imacro script lines are:

Code: Select all
URL GOTO=http://203.xx.xxx.xxx/Fleet_Online/reports/WebReports/NetworkConnectivity.aspx
TAG POS=3 TYPE=TBODY ATTR=* EXTRACT=TXT

'The SAVEAS statement was added manually to write the extracted table to a file
'(The alternative way to get the extracted data is the Scripting Interface)
SAVEAS TYPE=EXTRACT FOLDER=C:\Downloads FILE=Connectivity_{{!NOW:yymmdd_hhnnss}}.csv

'WAIT SECONDS=2
URL GOTO=http://demo.imacros.net/Automate/OK


.................................................................................................

The first 10 text rows are a single row of column headings.
The rest are the elements which go in the columns

I have searched for some time to find out why I cannot get comma and quotes delimited data being saved to the .csv file.

Can you please advise what I am doing wrong here.

Any assistance is much appreciated.

Cheers
Bernard

You can try (manually) modifying the 'TYPE=TBODY' to 'TYPE=TABLE' and to play with 'POS=3 / 2 / 1' unless there are really 3 Tables on your Page...

Provide the URL or upload some (zipped, max 256Kb) HTML Saveas of the Page if it's behind Login and Password if you don't come out by yourself.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 2 guests

-->