Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #13: HTML Table Parsing

akuma162
6 - Meteoroid

My solution


This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

JDelgado
8 - Asteroid

I'll say it again... I hate RegEx!!!!!

 

But I got it done, lol.

 

JohnD


This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

AndyBate
8 - Asteroid

Complete


This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

JORGE4900
8 - Asteroid

Hello all,

 

I tried 3 different methods to extract the value pairs out of that file.

 

First: I ended up using 9 Regex replace tools, 2 text to columns, 1 data cleansing tool, and 1 select tool to wrangle the data into value pairs; however, this would not be scalable with other html files.

 

Second: I ended up using 8 Regex replace tools, 1 JSON parse tool, and 1 select tool to turn the html into JSON format and get value pairs. Again: this method would not be scalable with other html files.

 

Third: I added the below script code to the head portion of the html to be able to use the jQuery library and created a looping mechanism to iterate through all the tr elements and pushed the td elements' contents into an array to be able to view the results on the console tab of the browser developer window. This gives me the opportunity to copy and paste the results into Excel separated by a pipe. Now: this would be scalable for any html file.

 

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

 

 

$('tr').each(function() {
var text;
var list = [] ;
text = text + $(this).html() + '|' ;

list.push(text);
console.log( list);})

 

 

 


This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

petgrap
8 - Asteroid

This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

Gauthier_B
8 - Asteroid

This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

luciebrett
8 - Asteroid

Small differences in the formulae used


This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

PrivateStorm
8 - Asteroid

My HTML table parsing solution is attached.


This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

arein0
8 - Asteroid

This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.

CaraI
Alteryx
Alteryx

The first iteration wasn't pretty but functional, so decided to redo and then tackle with RegEx and use the create columns after some solution inspiration.

 

Spoiler

This post has been edited by Community Moderation to redact sensitive attachments. The original attachment has been replaced by post_placeholder.txt.