OK so stick with me on this one... it's a little involved. I won't describe it all, I'll simplify things as best I can to the basics.

OK so, on my wordpress site I have three text boxes (BOX1,BOX2,BOX3). These need to display specific numbers, that are brought in live from a Google Sheets table. If the table gets updated, these boxes need to update immediately (on page refresh). I have this working already using this, which means all I need to do is put a shortcode into each text box, and it automatically displays the right data. Which is working fine... except that I actually have about 20 of these boxes, and google has a limit of 10 API calls per second. So a page refresh takes several seconds.

An alternative is to simply embed or autofill a Tablepress or similar table, and grab the entire Google Sheets table with one request. But these tables can only be formatted -as- tables, which isn't what I want.

So what I would LIKE to do (but which may not be possible), is to somehow change this into two steps = 1. Use a single shortcode or other trigger to grab the entire Google Sheets table in a single API call. (or at least grab 1 entire field per call, if splitting it up makes step 2 easier, it'd still mean only 3 calls instead of 20). 2. Then use seperate shortcodes (or whatever) in each text box like I am now, to select what cell's data appears in which box.

I suspect the answer may lie in some kind of... grabbing the Sheets data into Arrays, and then parsing the arrays with calls that show "item1" or "item5". The data will always be in a consistent order, so I guess this might work. I have zero idea how it might be done though, and I'm not sure how you'd grab the data from Sheets.

Hence being here, just to see if there's a method or solution that is escaping me. I'm suspecting I won't get any replies lol, but worth a try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.