View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

4.7 | 7 ratings Rate this file 19 Downloads (last 30 days) File Size: 1.97 KB File ID: #39915 Version: 1.0



Daniel (view profile)


18 Jan 2013 (Updated )

Download a google spreadsheet as csv and import into a Matlab cell array.

| Watch this File

File Information

result = GetGoogleSpreadsheet(DOCID)
[DOCID] A value like '0AmQ013fj5234gSXFAWLK1REgwRW02hsd3c', which is found in your spreadsheet's url:<here>/edit#gid=0.

[result] cell array of the the values in the spreadsheet

IMPORTANT: The spreadsheet must be shared with the "anyone with the link" option.

This has no error handling and has not been extensively tested.
Please report issues in comments below.

Thanks to @MarkTomaszewski and @Constantine for noting the updated url format (the above description has been updated to reflect this).


This file inspired Matlab To Google Sheets (Matlab2sheets).

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (10)
01 Oct 2016 Shaun

Shaun (view profile)

This script works well, just a note that adding new lines within the sheet cells results in incorrect parsing of the sheet.

Comment only
01 Oct 2016 Shaun

Shaun (view profile)

01 Oct 2016 Stuart McGarrity  
01 Oct 2016 Stuart McGarrity  
20 Sep 2016 abogaard

abogaard (view profile)

you sir have revolutionized my labnotes

24 Dec 2015 Constantine

Hi, it took me a while to figure out this very useful script for transferring info from google sheets. The 'DOCID' info in the script didn't mention getting rid of the /edit#gid=0 and spreadsheets/d stuff... what you stated explicitly in the helpful response below. If you can update the comments in the script it would be nice! Thanks!

Comment only
17 Dec 2015 Oyvind Tangen Odegaard

Thanks for a great script works fine. :-) Any ideas on how to also store a hyperlink associated with a cell text, though?

12 Jun 2015 Mark Tomaszewski


Thank you very much! This works perfectly when the sheet is set up to be viewed by anyone with the link. Otherwise, the output contains a large cell array of html.

Is there any way to make this work for sheets that are set up without sharing?

Also, your description may benefit from edits according to the following...


When I access my sheet in browser I see a URL that looks like this:<the text here is the doc id>/edit#gid=0

Hope this helps!


02 Apr 2015 Adam Danz

Adam Danz (view profile)

This looks incredibly useful.

Any updates now that google sheets has been merged with good drive and no longer contains the 'key=' part (replaced with /d/ but still doesn't work with this code) ?

Comment only
22 Jul 2013 Nagavenkat

worked perfectly
Thank you

02 Jan 2016 1.0

update description as suggested by commenters

02 Jan 2016 1.0

minor reformat description

Contact us