Download Unsplash Photos to Google Drive

Unsplash is the best source for free images on the Internet. The images have the Creative Commons zero license meaning you can do anything with the photos.

This Google Script uses the Unsplash API to fetch the most recently uploaded photos and downloads them to your Google Drive. The photo details, like the height, width, creator name, full RAW link, etc. are appended to a Google Spreadsheet.

You can set this is a time-based trigger to automatically save all the new Unsplash photos in your Google Drive. Change the page parameter to download all the old pictures as well. You would however need to create your CLIENT_ID for the API call.

function getUnsplashPhotos() {

    try {

        var ss = SpreadsheetApp.getActiveSheet();

        // Fetch a maximum of 30 photos per API call
        var url = "";

        // Parse the JSON response in an Array
        var photos = JSON.parse(UrlFetchApp.fetch(url).getContentText());

        for (var p = 0; p < photos.length; p++) {

            var categories = [],
                photo = photos[p];

            for (var c = 0; c < photo.categories.length; c++) {

            var blob = UrlFetchApp.fetch(photos.urls.full).getBlob();

            var file = DriveApp.createFile(blob);


            var row = [
                photo.created_at.substr(0, 10),
                categories.join(", "),
                photo.color, // Main Color Hex Mode
                photo.likes, // How popular is the photograph
      , // Credit the photographer
                photo.urls.raw, // Full high res version URL
                file.getUrl() // URL of the photo in Google Drive



    } catch (f) {