1

I'm an absolute beginner when it comes to programming. I've been trying to import data table from "http://www.rotowire.com/daily/nba/value-report.htm" into google spreadsheets.

I came across Google Apps Scripts and urlfetchapp basic authentication and tried to create and run a script but I can't figure it out. This is the code I tried using to for the basic authentication ([came across here][1]):

function myTest() {
      
var USERNAME = PropertiesService.getScriptProperties().getProperty('johndoe22');   
var PASSWORD = PropertiesService.getScriptProperties().getProperty('doejohn11');
var url = PropertiesService.getScriptProperties().getProperty('http://www.rotowire.com/daily/nba/value-report.htm');
}

Nothing happens when I run this script, what am I doing wrong? I just need the script to be able to pull info from that website.

Thanks for all your help.

Ravindra Gullapalli
  • 9,049
  • 3
  • 48
  • 70
Daniel
  • 33
  • 2
  • 4
  • The code you provided is just three variables - is there anything else? – Jens Astrup Dec 31 '15 at 22:03
  • I got the code here ;, I think I'm missing some parts to the code tho, any help. – Daniel Dec 31 '15 at 22:30
  • 1
    The properties service is a storage feature. It stores data in "key/value" pairs. For your line of code with the variable `url`, you have entered a url where the "key" name is needed. I'm assuming that you want the url to be the **value** and not the **key**. In order to *get* a property, you needed to have *set* a property. Did you set a property with a key name of: `http://www.rotowire.com/daily/nba/value-report.htm`. Normally, you'd set a property with a key name of something like 'dataURL', and then the value would be the actual url. `setProperty('dataURL','http://www.domain.com')` – Alan Wells Jan 01 '16 at 06:23

1 Answers1

2

If you're just trying to import the table from that website, you don't need Google Apps Scripts - you can do that with the built in spreadsheet function "IMPORTHTML":

=IMPORTHTML("http://www.rotowire.com/daily/nba/value-report.htm","table","1")

You can read more about the function in the Google spreadsheet function list. I made a spreadsheet using this that you can view.

Jens Astrup
  • 2,415
  • 2
  • 14
  • 20
  • 1
    Thanks for the answer, but the reason I'm using google app script is so that I can get past the authentication and get the whole table. There are more than twelve players but I can get the whole table without login in. I tried login in and them importing but it didn't work @Jens Astrup – Daniel Dec 31 '15 at 22:25