0
$\begingroup$

Consider the PISA study report, which contains dozens separate spreadsheets in each respective excel files (see http://www.oecd.org/pisa/keyfindings/pisa-2012-results-volume-iv.htm) Is there any way to call on a particular spreadsheet when one import the material?

$\endgroup$
1

1 Answer 1

2
$\begingroup$

Assuming the XLS file is in this URL:

url = "http://statlinks.oecdcode.org/982013061P1T001.XLS";

This gives you the list of sheets in the XLS file

sheetslist = Import[url, {"XLS", "Sheets"}];

And you can Import the second sheet by

Import[url, {"Sheets", sheetslist[[2]]}]

Backtracking, now to get that URL...

Get a list of links in the page:

urlHome="http://www.oecd.org/pisa/keyfindings/pisa-2012-results-volume-iv.htm";
linklist=Import[urlHome, "Hyperlinks"];

Select only the ones that point to doi.org as those are the XLS files

urldoi = Select[linklist, StringMatchQ[#, "http://dx.doi.org" ~~ __] &]

You can confirm that by fetching the URL headers

headers = URLFetch[#, "Headers"] & /@ urldoi ;

headers[[All, 3, 2]]

{"http://statlinks.oecdcode.org/982013061P1T001.XLS", \ "http://statlinks.oecdcode.org/982013061P1T002.XLS", \ "http://statlinks.oecdcode.org/982013061P1T003.XLS", \ "http://statlinks.oecdcode.org/982013061P1T004.XLS", \ "http://statlinks.oecdcode.org/982013061P1G001.XLS", \ "http://statlinks.oecdcode.org/982013061P1T005.XLS", \ "http://statlinks.oecdcode.org/982013061P1T006.XLS", \ "http://statlinks.oecdcode.org/982013061P1G002.XLS", \ "http://statlinks.oecdcode.org/982013061P1T007.XLS", \ "http://statlinks.oecdcode.org/982013061P1G003.XLS", \ "http://statlinks.oecdcode.org/982013061P1G003.XLS", \ "http://statlinks.oecdcode.org/982013061P1T008.XLS", \ "http://statlinks.oecdcode.org/982013061P1G004.XLS", \ "http://statlinks.oecdcode.org/982013041P1T010.XLS", \ "http://statlinks.oecdcode.org/982013041P1T011.XLS", \ "http://statlinks.oecdcode.org/982013061P1T010.XLS", \ "http://statlinks.oecdcode.org/982013061P1T009.XLS"}

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.