Editing script for receiving web data in Numbers/Excel

Hello together,


searching for a way to mimic a Windows-Excel/API-based process for getting current crypto-currency prices into a spreadsheet, I found this super helpful script for Numbers.


How to grab web data into Numbers sheet - Apple Community (Best answer in this thread)


It works perfectly, but I have two issues (and unfortunately, zero knowledged of apple script yet):


1) The script gives me only the coins from the first worldcoinindex-page (actually the top 100), but I also need the data from page 2,3,4,... (finally the top 2000) in the same document.


2) I am very much used to work with Excel and tried to redirect the script to Excel instead of Numbers. It didn't work. Is this generally possible?


Thanks in advance for your help!

Georg

Posted on Jul 9, 2023 1:43 PM

Reply
5 replies

Jul 10, 2023 2:28 PM in response to SGIII

Great! Now I got the point of defining "tgtCell" in line 3 and calling it in the numbers section... I copied the script (except for lines 1 and 2), set tgtCell to 102, and added /2 behind the website address, and it works. For sure not the most elegant way, but it does its job...


I will not use the script too often (once every few weeks) so data scraping shouldn't be an issue. I just love to have things automated and lean - thus the script.


Thanks a lot!


Jul 10, 2023 7:05 AM in response to georg179

It's very hard to give guidance without knowing specifically what you are trying to do, and where you want to put the data. tgtCell is where the script places the data. You can vary that to place the data starting in another cell than A2.


Note that this script will break if the website changes its structure. Also data "scraping" may be against the website's policy, particularly if you do a lot of it and often.


Have you considered just copy pasting a page of date from the website into an existing Numbers table? That works well here. Select the data, command-c to copy, click once in a Numbers cell, Edit > Paste and Match Format.


SG





Jul 10, 2023 6:12 AM in response to SGIII

Thanks for your quick reply - and again, for the great piece of code!


I saw that /2 etc., works; however - being a complete newby with Apple - I need to figure out how to extend the script to get the content from pages 2, 3, etc., into my sheet below the already existing content from page 1. Could you let me know how to do that?


Thanks again,

Georg

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Editing script for receiving web data in Numbers/Excel

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.