Update data from Google Sheets to MATLAB continuously

1 visualizzazione (ultimi 30 giorni)
Hi guys. I come from Vietnam.
I have a few questions, hope someone can help.
- I use the code GetGoogleSpreadsheet to send data from Google Sheets to MATLAB.
- How to update data from Google Sheets to MATLAB continuously with just one click of "Run"? While GoogleSheet is always updating new data.
- Is it possible to create an infinite loop for GetGoogleSpreadsheet and set X seconds back to execute the loop again?
Someone help me cause i'm in a hurry!
Thank you very much! Good luck!

Risposte (1)

Walter Roberson
Walter Roberson il 21 Nov 2021
When I look at the code at https://www.mathworks.com/matlabcentral/fileexchange/39915-getgooglespreadsheet it looks to me as if the code could be broken up so that you had an initialization phase that (I suspect) would only need to be done once. I suspect the rest of the code could be broken out so that you could call it to get a new update.
However, it looks to me as if the code probably needs to open a new https connection and fetch the entire contents each time. It might possibly the case that you could modify the code to only return certain ranges of data -- but if the idea happens to be that you are working collaboratively with someone then you would need to fetch the entire sheet anyhow as you do not know where they are modifying.
I am pretty certain that you cannot use this technology to ask "what is updated?" -- there might be other ways of doing that, maybe.
For continuous updates, your code would have to loop asking for an update.
When I look around, I do not find any way of asking for part of the document -- but perhaps I just did not look in the right place.
  2 Commenti
Nguyen Trung Hieu
Nguyen Trung Hieu il 22 Nov 2021
I tried everything for a month but it didn't work, I'm really disappointed.
Hope you help me!
This is the code that i use to get data from Google Sheet to MATLAB.
Walter Roberson
Walter Roberson il 22 Nov 2021
So what is the problem with writing
while true
result = getdata();
openvar('result');
sleep(10);
end

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by