Code covered by the BSD License  

Highlights from
Matlab to Google Spreadsheets

4.71429

4.7 | 8 ratings Rate this file 25 Downloads (last 30 days) File Size: 14.3 KB File ID: #31221

Matlab to Google Spreadsheets

by

 

27 Apr 2011 (Updated )

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

Create Google Calendar Event With Sms And Email Notification and 41 Complete Gui Examples inspired this file.

This file inspired View And Add Transaction To Portfolios On Google Finance.

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (14)
12 Oct 2014 Kristjan Poder

Has worked brilliantly until recently, when can not obtain tokens from Google any more. Is there a fix of any nature?

23 Apr 2014 Kent Conover

Great idea, but "MatlabGoogTest" returns "Could not obtain authorization tokens from Google." when I try to log in. I am eager to see a fix!

11 Oct 2013 Sven

Wonderful work. The two things stopping 5 stars at the moment is documentation (none of the functions that the user must call have any help contents) and the 1-cell-at-a-time functionality only.

It would be very advantageous to supply similar functionality to xlsread/xlswrite, which both accept a cell range to read/write, and if no range is given, xlsread simply returns the full contents of that worksheet.

09 Apr 2013 Malte Ahm

Really great functions! what is missing for me is a "editWorksheetCellBatch" function to be able to edit larger worksheets quicker.

I can see, that the Google API should support it:

https://developers.google.com/google-apps/spreadsheets/#updating_multiple_cells_with_a_batch_request

I have tried making the function myself, but my experience with java and html protocols is very limited. I keep getting an error 400 (Bad Request) when i try to send the data to the server (ps.print(event)).

08 Apr 2013 Thomas

How long is the authentication valid for? I'm running this in a loop and I start getting 403 errors after about 500 seconds, which doesn't happen if I run each iteration by itself

08 Apr 2013 Thomas  
08 Apr 2013 Thomas

Works great!

12 Nov 2012 Eric Trautmann  
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

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

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 ].

24 Jun 2011 Jake Hughey  
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.

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.

Updates
20 Jun 2011

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

Contact us