Reading data from google spreadsheet

29 ビュー (過去 30 日間)
Sergio Silveira
Sergio Silveira 2021 年 6 月 16 日
回答済み: KSSV 2021 年 6 月 16 日
Hello,
I'm reading data from a google spreadsheet file using the following code:
url_name = sprintf('https://docs.google.com/spreadsheets/d/%s/gviz/tq?tqx=out:csv&sheet=%s',docid);
sheet_data = webread(url_name);
where docid is the spreadsheet's identifier and sheet_data is a table type variable.
The problem is that the headers are all messed up (spaces between words are removed, special characters such as "ã, ç,ô,...", are ignored, and so on) and I'll need them further in the code.
This only occurs with the headers. The other cells in the spreadsheet that contain text are properly imported.
Is there a way to overcome these issues?
Thanks in advance.
  1 件のコメント
Sergio Silveira
Sergio Silveira 2021 年 6 月 16 日
Just found out a workaround:
url_name = strcat('https://docs.google.com/spreadsheets/d/',docid,'/export?format=xlsx');
websave('output.xlsx',url_name);
Then I read the output.xlsx file (which is formatted as I wish).

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2021 年 6 月 16 日

カテゴリ

Help Center および File ExchangeGoogle についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by