# Import online Google Docs spreadsheet data

**URL:** <https://community.wolfram.com/t/import-online-google-docs-spreadsheet-data/4039>\
**Category:** Questions\
**Tags:** external-interfaces, import-and-export\
**Created:** [November 18, 2014, 12:47pm UTC](https://community.wolfram.com/t/import-online-google-docs-spreadsheet-data/4039 "2014-11-18T12:47:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cfd](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/cfd/32/30656_2.png) [@cfd](https://community.wolfram.com/u/cfd)\
**Post date:** [November 18, 2014, 12:47pm UTC](https://community.wolfram.com/t/import-online-google-docs-spreadsheet-data/4039/1 "2014-11-18T12:47:59Z")

</div>

I have some data in Googlespread

[https://docs.google.com/spreadsheets/d/1BvqdIUxuMVS2kNsg4tl53iVpNyj1tnYnO3zXH5qW9Rk/edit?usp=sharing](https://docs.google.com/spreadsheets/d/1BvqdIUxuMVS2kNsg4tl53iVpNyj1tnYnO3zXH5qW9Rk/edit?usp=sharing)

How can I import them?

Thanks,  
Christian

---

<div class="post-metadata">

**Author:** ![Vitaliyk](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/vitaliyk/32/45591_2.png) [@Vitaliyk](https://community.wolfram.com/u/Vitaliyk)\
**Post date:** [November 18, 2014, 1:57pm UTC](https://community.wolfram.com/t/import-online-google-docs-spreadsheet-data/4039/2 "2014-11-18T13:57:04Z")

</div>

You should look into [URLFetch](http://reference.wolfram.com/language/ref/URLFetch.html) for potential alternatives, but simple import works too:

```
data = Import["https://docs.google.com/spreadsheets/d/1BvqdIUxuMVS2kNsg4tl53iVpNyj1tnYnO3zXH5qW9Rk", "Data"];

```

 ![ScreenShot2014-11-18at7.54.04AM.png](https://global.discourse-cdn.com/wolfram/original/3X/7/a/7a12bb899444d187eea8aaaec256f6d36dfa1c9a.png)

and then some sort of parsing or data manipulation:

```
data[[2, 1, 2]] // TableForm

```

 ![2014-11-18_07-55-49.png](https://global.discourse-cdn.com/wolfram/original/3X/e/b/eb6b726b8181c02406343c268f56fe6b01d43882.png)

---

<div class="post-metadata">

**Author:** ![arnoudb](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/arnoudb/32/41177_2.png) [@arnoudb](https://community.wolfram.com/u/arnoudb)\
**Post date:** [November 18, 2014, 2:28pm UTC](https://community.wolfram.com/t/import-online-google-docs-spreadsheet-data/4039/3 "2014-11-18T14:28:15Z")

</div>

You can modify your url to change the format to CSV for downloading:

```
url = "https://docs.google.com/spreadsheets/d/1BvqdIUxuMVS2kNsg4tl53iVpNyj1tnYnO3zXH5qW9Rk/export?format=csv";

```

Then you can import it (I needed to use the CharacterEncoding option to get the characters to import normally):

```
csv = Import[url, "CSV", CharacterEncoding -> "UTF8"];

```

Then you can make a Dataset, which makes data a little bit easier to reason with in many cases:

```
dataset = Dataset[Map[AssociationThread[First[csv], #] &, Rest[csv]]]

```

 ![species1.PNG](https://global.discourse-cdn.com/wolfram/original/2X/7/763efbe10dca44e3e3b4c776685a31ca1153537d.png)

Now you can get all the species with pin equal to 7, for example:

```
dataset[Select[#Pin == 7 &]]

```

 ![species2.PNG](https://global.discourse-cdn.com/wolfram/original/3X/3/7/37601dbd8b018b2692a3ded725ae4a88d5c7f75d.png)

Or do the same and then sort by species, alphabetically:

```
dataset[Select[#Pin == 7 &] /* SortBy[#Species &]]

```

 ![species3.PNG](https://global.discourse-cdn.com/wolfram/original/2X/5/51af0b8ec9f7d35706fb893f3c16a1c4153f6fdb.png)

Or group by species, get a count of how many there are for each species (using Length) and sorting that in descending order:

```
dataset[GroupBy[#Species &] /* Sort /* Reverse, Length]    

```

 ![species4.PNG](https://global.discourse-cdn.com/wolfram/original/3X/d/0/d01ae3fc539e6c77bd9c2c26f6dd25684a15ac28.png)

Or group by station and then by species (the extra //Normal // Dataset should not be needed, but helps with formatting):

```
ds2 = dataset[GroupBy[#Plot &], GroupBy[#Species &] /* Sort /* Reverse, Length] // Normal // Dataset

```

 ![species5.PNG](https://global.discourse-cdn.com/wolfram/original/2X/7/787f479f44b651ad0b36a9ca7cf4a9107cf2062f.png)

Or, proceeding with data set ‘ds2’, make pie charts for each distribution:

```
ds2[All, PieChart[#, ChartLegends -> Keys[#]] &]

```

 ![piechart1.png](https://global.discourse-cdn.com/wolfram/original/3X/5/a/5a472eedcc1a6ab5a7047611f96fc51a4709af25.png)

---

<div class="post-metadata">

**Author:** ![Vitaliyk](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/vitaliyk/32/45591_2.png) [@Vitaliyk](https://community.wolfram.com/u/Vitaliyk)\
**Post date:** [November 18, 2014, 2:57pm UTC](https://community.wolfram.com/t/import-online-google-docs-spreadsheet-data/4039/4 "2014-11-18T14:57:30Z")

</div>

This is excellent, Arnoud!

---

<div class="post-metadata">

**Author:** ![sawilkus](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@sawilkus](https://community.wolfram.com/u/sawilkus)\
**Post date:** [October 16, 2021, 3:22am UTC](https://community.wolfram.com/t/import-online-google-docs-spreadsheet-data/4039/5 "2021-10-16T03:22:01Z")

</div>

Thank you for the excellent discussion. This has been very helpful.  
Next question, how to import multiple sheets (aka tabs) from Google Sheets?
