Using .split to convert a bunch of items to an array (list)
Thanks to Zarino Zappio for this tip following an email to the Scraperwiki mailing list. The particular problem for which this was one possible solution was having a list of codes that you need a scraper to loop through. (In the end I solved this by using the =JOIN formula in the spreadsheet containing the codes (and adding an extra inverted comma at the start and finish))
But if that list of numbers is on a page, here's a useful way to convert it into an array:
"Get your scraper to loop over them as an array. You'd probably need to do some formatting, but it depends how your spreadsheet program handles copying cells. If it's generous and just gives you a string with the cell values separated by spaces or line breaks, you can use python to split the string into an array, over which you can loop…
pastedtext = "5237521 4398721 5293752 5967124"lovelyarray = pastedtext.split()# we now have a lovely array like ['5237521', '4398721', … '5967124']for id in lovelyarray:print scraperwiki.scrape('http://yoururl.org.uk/page?iSchoolID=' + id)