def _setup_google_spreadsheets(settings, path, prompt=True):
    """
    Set up a Google spreadsheet.
    """
    ret = {}
    if prompt:
        use = raw_input("\nWould you like to use Google spreadsheets [Y/n]? ")
        if use.lower() != "y" and use != "":
            return settings

    dirname = os.path.dirname(path)
    path = os.path.join(dirname, "client_secrets.json")

    write_secrets = True
    if os.path.isfile(path):
        write_secrets_input = raw_input("client_secrets.json already exists. Would you like to overwrite it? [y/N] ")
        if not write_secrets_input.lower().startswith('y'):
            write_secrets = False

    if write_secrets:
        puts(("\nLogin in to Google and go to {0} to create an app and generate a "
              "\nclient_secrets authentication file. You should create credentials for an `installed app`. See "
              "\n{1} for more information."
              .format(colored.red("https://console.developers.google.com/project"),
                      colored.red("http://tarbell.readthedocs.org/en/{0}/install.html#configure-google-spreadsheet-access-optional".format(LONG_VERSION))
                     )
            ))

        secrets_path = raw_input(("\nWhere is your client secrets file? "
                                  "[~/Downloads/client_secrets.json] "
                                ))

        if secrets_path == "":
            secrets_path = os.path.join("~", "Downloads/client_secrets.json")

        secrets_path = os.path.expanduser(secrets_path)

        puts("\nCopying {0} to {1}\n"
             .format(colored.green(secrets_path),
                     colored.green(dirname))
        )

        _backup(dirname, "client_secrets.json")
        try:
            shutil.copy(secrets_path, os.path.join(dirname, 'client_secrets.json'))
        except shutil.Error as e:
            show_error(str(e))

    # Now, try and obtain the API for the first time
    get_api = raw_input("Would you like to authenticate your client_secrets.json? [Y/n] ")
    if get_api == '' or get_api.lower().startswith('y'):
        get_drive_api_from_client_secrets(path, reset_creds=True)

    default_account = settings.get("google_account", "")
    account = raw_input(("What Google account(s) should have access to new spreadsheets? "
                         "(e.g. somebody@gmail.com, leave blank to specify for each new "
                         "project, separate multiple addresses with commas) [{0}] "
                            .format(default_account)
                        ))
    if default_account != "" and account == "":
        account = default_account
    if account != "":
        ret = { "google_account" : account }

    puts("\n- Done configuring Google spreadsheets.")
    return ret
Set up a Google spreadsheet.