Import data from google sheets to matlab

176 次查看(过去 30 天)
Hello guys,
I wanted to import data from google sheets to matlab. However I couldn't find any information about it. Since the google sheets always geting update I can't just copy and paste so I wanted to import new data for every time I run the matlab script. Is there a way?
Thanks in advance.

回答(3 个)

Donald
Donald 2021-3-4
First, find the ID for your Sheet. It's the long string if you look at the URL. For example,
http s://docs.google.com/spreadsheets/d/bladjaljd77442n2j3ljk2j3j2jdkdjad/edit#gid=1498695871
Then it's easy
ID = 'bladjaljd77442n2j3ljk2j3j2jdkdjad'
sheet_name = 'My Sheet';
url_name = sprintf('https://docs.google.com/spreadsheets/d/%s/gviz/tq?tqx=out:csv&sheet=%s',...
ID, sheet_name);
sheet_data = webread(url_name);
  5 个评论
thierry Lanoe
thierry Lanoe 2023-3-25
is there a solution with "protected sheets"
O.Hubert
O.Hubert 2024-6-5
Bennet, have you tried passing the ContentType option to webread (see the help here)?

请先登录,再进行评论。


Hiro Yoshino
Hiro Yoshino 2019-12-12
  1 个评论
Hüseyin Cagdas Yatkin
I think this is for the offline files, I want to take from online source which is specifically google sheets.

请先登录,再进行评论。


dimuthu chathuranga
I have same problem please help me I want to real time uptade data fron google sheet to mathlab gui

标签

Community Treasure Hunt

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

Start Hunting!

Translated by