Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9701

ImportHTML Altering Data Format/URL Fetch Issue

$
0
0

4/17 6PM Update *** I am now trying to use the URL Fetch App. I've been playing with this for hours, but can't seem to figure out the issue. I am just trying to get the info from this site as plain text (so the score doesn't mess up) in a Google Sheet.

function myFunction() {    var response = UrlFetchApp.fetch("https://www.basketball-reference.com/boxscores/pbp/202003110MIA.html"); Logger.log(response.getContentText());   var doc = SpreadsheetApp.getActiveSpreadsheet();   var cell = doc.getRange('a1');}

I'm using ImportHTML to export NBA play by play data.

For some reason, random cells containing the score (formatted 12-10 as an example) transfer incorrectly as long numbers (43864 as an example).

I've tried various formatting options that are offered & I've looked at different games as well, but don't see any patterns as to why certain scores work and others don't.

Lastly, when I copy and paste the info directly from the site it works flawlessly, but when you paste as values the score becomes incorrect -- I'm assuming that is what ImportHTML is doing.

Could someone possibly explain to me why this is happening? Is there a way to make sure all scores stay correctly formatted?

For reference, I'm building a script that will take all of this information, and transform it so that I can track different events for players based off of time. This has been my one little hiccup I can't seem to get past.

I've attached screenshots of the error in Sheets, along with the information as it is on the website.enter image description here

enter image description here


Viewing all articles
Browse latest Browse all 9701


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>