5.0

5.0 | 2 ratings Rate this file 19 Downloads (last 30 days) File Size: 14.27 KB File ID: #31221

Matlab to Google Spreadsheets

by Claudiu Giurumescu

 

27 Apr 2011 (Updated 20 Jun 2011)

Matlab functions to send data to Google Spreadsheets.

| Watch this File

File Information
Description

This set of Matlab functions will allow creating Google
spreadsheets, adding worksheets to them, modifying the
worksheets, and placing data in them.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Create Google Calendar event with SMS and Email notification, 41 Complete GUI Examples
This submission has inspired the following:
View and add transaction to portfolios on Google Finance

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
18 Jun 2011 Jake Hughey

this set of functions looks great, but what is missing for me is a "getWorksheetCell" function, because I also want to pull data from google spreadsheets into matlab. I don't know java well enough to write one myself.

20 Jun 2011 Claudiu Giurumescu

Jake,

Thanks for the suggestion. I've updated the submission. You can now read both the cell value and its formula.

Hope this helps.

24 Jun 2011 Jake Hughey  
11 Feb 2012 Ted P Teng

Excellent toolbox! You can also easily modify the 'editWorksheetCell' to edit for an array of cells instead of individual cells for reducing the number of http requests [ http://code.google.com/apis/spreadsheets/data/3.0/developers_guide.html#ListFeeds ].

26 Apr 2012 Matt Behr

hello .... is there anyway to avoid the credentials dialog. I want to run a script nightly to update data in google docs.

Thanks!
Matt

26 Apr 2012 Claudiu Giurumescu

Matt,

The code below should work (replace connectNAuthorize function in the package with the one below)
urlread should be provided by Matlab.

The 'writely' token is for Google Spreadsheets, the 'wise' token is for Google Docs.

Once you have the tokens you can use the other functions in the package.

Hope this helps,
Claudiu
%%%%%%%%%%%%%%%%%%%%%%
userName='...@gmail.com';
password='...';

[authorized, aTokenS]=connectNAuthorize(userName, password,'writely');
if (~authorized)
    result=-1;
    return;
end
[authorized, aToken]=connectNAuthorize(userName, password,'wise');
if (~authorized)
    result=-1;
    return;
end

function [authorized, aToken]=connectNAuthorize(userName, password,service)

[str,authorized]=urlread('https://www.google.com/accounts/ClientLogin','POST',...
    {'Email',userName,'Passwd',password,'source','My-Matlab-1','service',service});

if authorized==1
    aToken=['auth' str(strfind(str,'Auth')+4:end-1)];
else
    aToken='';
end

Please login to add a comment or rating.
Updates
20 Jun 2011

Google login process has dialog box. New function reads values and formulas from the Google spreadsheet.

Tag Activity for this File
Tag Applied By Date/Time
data export Claudiu Giurumescu 28 Apr 2011 12:15:52
data import Claudiu Giurumescu 28 Apr 2011 12:15:52

Contact us at files@mathworks.com