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.
12-10
becomes43864
it means Google-sheet interpret it as a date. You can try to force a format with=text()