Matlab to Google Sheets (matlab2sheets)

버전 1.0.0.0 (484 KB) 작성자: Andrew Bogaard
This function (and run-once helper function) exports data to a Google spreadsheet
다운로드 수: 1.9K
업데이트 날짜: 2017/9/21

Use this together with GetGoogleSpreadsheet from the File Exchange and you can read/write to Google Sheets from MATLAB. Inspired by an older set of functions (Matlab to Google Spreadsheets) that no longer works with Google's new v4 API.
--
status = mat2sheets(spreadsheetID, sheetID, sheetpos, d)
% This function takes values from an array or cell array and places them in
% a Google spreadsheet. It requires the one-time use of RunOnce (see below)
% SYNTAX: status = mat2sheets(spreadsheetID, sheetID, pos, d)
%
% ARGUMENTS:
% spreadsheetID: (string), identifier from URL of your Google Sheet
% sheetID: (string), another identier from URL
% pos: 1x2 array with indices for [sheetrow, sheetcolumn]
% to start pasting data
% d: array or cell array of data to paste into Sheet. If
% [], pos indicates row or range of rows [start stop]
% to delete
%
% RETURNS: status (0=failed, 1=success)
%
% EXAMPLES:
% For sheet with the following URL:
% https://docs.google.com/spreadsheets/d/1GPd-vBsX5VUejz5hrxE/edit#gid=552
%
% A call may look like:
% mat2sheets('1GPd-vBsX5VUejz5hrxE', '552', [2 3], [1 2 3 4 5])
%
% Would put values 1,2,3,4,5 into cells C2,D2,E2,F2,G2, respectively
%
% To delete row(s)
% mat2sheets('1GPd-vBsX5VUejz5hrxE', '552', 2, []) % delete row 2
% mat2sheets('1GPd-vBsX5VUejz5hrxE', '552', [2 10], []) % delete rows 2-10 inclusive
%
% USING RunOnce().
% Before using this code, you've got to enable the Drive/Sheets APIs via:
% https://console.developers.google.com/
% Here, you will "create credentials" via an OAuth 2.0 client ID that comes
% with a Client ID and Client Secret. These codes are the two arguments of
% RunOnce(client_id, client_secret). Run RunOnce with both of these
% codes passed as strings, and follow the instructions.
%
% The following code is inspired by, and makes use of, code
% originally published in the file exchange by Claudiu Giurumescu.
% (https://www.mathworks.com/matlabcentral/fileexchange/31221-matlab-to-google-spreadsheets)
%
% I wrote this to accomodate for latest changes in Google API, added some
% comments, and simplified it all so that it can be implemented by the
% average user (hopefully!)
%
% Additionally, I use loadjson by Qianqian Fang to read the input streams
% from Google for learning meta data about the sheets
% (https://www.mathworks.com/matlabcentral/fileexchange/33381-jsonlab--a-toolbox-to-encode-decode-json-files)
%
% andrew robert bogaard 26 sept 2016
% updated 25 july 2017 (delete rows)
% abogaard@uw.edu

인용 양식

Andrew Bogaard (2025). Matlab to Google Sheets (matlab2sheets) (https://github.com/abogaard/matlab2gsheets), GitHub. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2014a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Google에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보
1.0.0.0

This is a beta version, not extensively tested. Please let me know what needs fixing! :)
added urlreadwrite to mat2sheets
-
removed beta release

trivial metadata updates
--
updated documentation
Added functionality to delete rows

% To delete row(s)
% mat2sheets('1GPd-vBsX5VUejz5hrxE', '552', 2, []) % delete row 2
% mat2sheets('1GPd-vBsX5VUejz5hrxE', '552', [2 10], []) % delete rows 2-10 inclusive

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.