View License

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

» Watch video

Highlights from
GetGoogleSpreadsheet

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

5.0
5.0 | 3 ratings Rate this file 20 Downloads (last 30 days) File Size: 1.97 KB File ID: #39915 Version: 1.0

GetGoogleSpreadsheet

by

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
Description

result = GetGoogleSpreadsheet(DOCID)
[DOCID] A value like '0AmQ013fj5234gSXFAWLK1REgwRW02hsd3c', which is found in your spreadsheet's url: https://docs.google.com/spreadsheets/d/<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).

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 (5)
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

@Daniel,

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

@Adam,

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

Hope this helps!

~Mark

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

Updates
02 Jan 2016 1.0

update description as suggested by commenters

02 Jan 2016 1.0

minor reformat description

Contact us