Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python

Overview

Autodrive

Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python. It is especially designed to provide as much assistance as possible when writing code through hints and autocompletion, as well as via thorough type checking and hinting. These features are currently optimized for VSCode, which you can download here if you wish. They should also work in other Python IDEs.


Documentation: https://autodrive-py.readthedocs.io/en/latest/


Requirements


Python 3.8+

Installation


Google API Credentials

Follow the steps outlined in the Prerequisites section here. Download and save the credentials.json file to the working directory you want to use Autodrive in.

First Connection

To test that your credentials provide the expected connection to your Google Drive account, simply instantiate an Autodrive Drive instance:

from autodrive import Drive

drive = Drive()

If your credentials file was saved as credentials.json, your browser should automatically open and prompt you to authorize the GCP project you created to access your Google Drive. Click the various Allow prompts it will show you to complete your first connection. After you see the browser switch to a page indicating you can close the process, you should see a gdrive_token.json file added to the working directory you saved your credentials.json file in. Next time you use an Autodrive element that needs to connect to your Drive, this token will be used and you will not be prompted to authorize access again until it expires.

Quickstart


The Drive class provides methods for finding and creating objects in your Google Drive, such as Folders or Sheets.

gsheet = drive.create_gsheet("my-autodrive-gsheet")

Finding IDs

If you use Drive to search for your Sheets and Folders, you don't need to supply the GSheet or Folder IDs yourself, but if you know exactly what Sheet you want, then you can directly instantiate a GSheet or folder by pulling the necessary info from the object's url.

For example, if your Sheet's url looks like this:

docs.google.com/spreadsheets/d/19k5cT9Klw1CA8Sum-olP7C0JUo6_kMiOAKDEeHPiSr8/edit#gid=0

Simply copy/paste the id between /d/ and /edit# as the gsheet_id:

from autodrive import GSheet

gsheet = GSheet(gsheet_id="19k5cT9Klw1CA8Sum-olP7C0JUo6_kMiOAKDEeHPiSr8")

Tabs: Because Google calls spreadsheets "Sheets", and their api also refers to the individual sub-sheets in a spreadsheet as "Sheets", Autodrive instead refers to them as "Tabs" for clarity.

For a tab, you can get the tab_id from:

docs.google.com/spreadsheets/d/19k5cT9Klw1CA8Sum-olP7C0JUo6_kMiOAKDEeHPiSr8/edit#gid=234276686

from autodrive import Tab

tab = Tab(
    gsheet_id="19k5cT9Klw1CA8Sum-olP7C0JUo6_kMiOAKDEeHPiSr8",
    tab_title="Sheet2",
    tab_idx=0,
    tab_id=234276686
)

For a folder:

drive.google.com/drive/u/1/folders/1wLx-KMG2jO498xa5ZumB-SEpL-TwczZI

from autodrive import Folder

folder = Folder(folder_id="1wLx-KMG2jO498xa5ZumB-SEpL-TwczZI", name="Test Folder")

Reading and Writing

You can easily download and write data from a Google Sheet using the GSheet, Tab, or Range views.

# Fetches all the data in all cells of the tab:
tab.get_data()

# Writes 8 cells (2 rows of 4 columns, starting in cell A1) to the tab:
tab.write_values(
    [
        [1, 2, 3, 4],
        [5, 6, 7, 8],
    ]
)

GSheet and Range have very similar methods, and all of them allow you to read and write data to only a specific range in the Google Sheet. See the Documentation for more.

You might also like...
Interact and easily use Google Chat room webhooks.

Chat Webhooks Easily interact and send messages with Google Chat's webhooks feature. This API is small, but should be a nice framework for working wit

First Party data integration solution built for marketing teams to enable audience and conversion onboarding into Google Marketing products (Google Ads, Campaign Manager, Google Analytics).

Megalista Sample integration code for onboarding offline/CRM data from BigQuery as custom audiences or offline conversions in Google Ads, Google Analy

Deepak Clouds Torrent is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.
Deepak Clouds Torrent is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.

Deepak Clouds Torrent is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.

A python based all-in-one tool for Google Drive

gdrive-tools A python based all-in-one tool for Google Drive Uses For Gdrive-Tools ✓ generate SA ✓ Add the SA and Add them to TD automatically ✓ Gener

This Mirror Bot is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.
This Mirror Bot is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.

MIRROR HUNTER This Mirror Bot is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive. Repo la

Slam Mirror Bot is a multipurpose Telegram Bot written in Python for mirroring files on the Internet to our beloved Google Drive.
Slam Mirror Bot is a multipurpose Telegram Bot written in Python for mirroring files on the Internet to our beloved Google Drive.

Slam Mirror Bot is a multipurpose Telegram Bot written in Python for mirroring files on the Internet to our beloved Google Drive.

A Telegram Bot written in Python for mirroring files on the Internet to your Google Drive

No support is going to be provided of any kind, only maintaining this for vps user on request. This is a Telegram Bot written in Python for mirroring

A Telegram Bot written in Python for mirroring files on the Internet to Google Drive

No support is going to be provided of any kind, only maintaining this for vps user on request. This is a Telegram Bot written in Python for mirroring

A telegram bot writen in python for mirroring files on the internet to Google Drive
A telegram bot writen in python for mirroring files on the internet to Google Drive

owner of this repo :- AYUSH contact me :- AYUSH Slam Mirror Bot This is a telegram bot writen in python for mirroring files on the internet to our bel

Comments
  • Google OAuth Library Changes Invalidate Autodrive Authentication Procedure

    Google OAuth Library Changes Invalidate Autodrive Authentication Procedure

    Describe the bug A clear and concise description of what the bug is.

    To Reproduce Steps to reproduce the behavior:

    1. Attempt to instantiate any object that makes a connection to the Drive or Sheets API.

    Expected behavior Auth Flow should solicit Drive and Sheets CRUD rights and then successfully allow both Drive and Sheets CRUD simultaneously.

    bug 
    opened by chrislarabee 1
Releases(v0.6.3)
  • v0.6.3(Oct 2, 2021)

  • v0.6.2(Oct 2, 2021)

    Changelog

    • Added Autodrive stub files.
    • Fixed an issue with file uploading functionality that could cause multiple files to be accidentally created with the same parameters.
    Source code(tar.gz)
    Source code(zip)
  • v0.6.1(Sep 19, 2021)

  • v0.6.0(Sep 8, 2021)

    Changelog

    • Added file uploading features, including ability to upload files and convert them to appropriate Google formats.
    • Added data appending features to Tab.write_values and GSheet.write_values.
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Aug 22, 2021)

    Changelog

    • Added append/delete/insert column(s) methods to Tab.format_grid.
    • Added set_alignment methods to format_text.
    • Made all FullRange arguments interchangeable with range strings in Google Sheet format (i.e. "A1:C10").
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Aug 4, 2021)

    Changelog

    • Added support for hex color codes to Color interface.
    • Added set_border_format and set_background_color formatting functionality.
    • Improved write_values method functionality to allow a greater range of input data types.
    • Various performance improvements to underlying functionality related to batching requests.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jul 24, 2021)

    Changelog

    • Added simple csv and json output methods to GSheet, Tab, and Range.

    Bug Fixes

    • Addressed issue #1, which involved a critical authentication fault caused by some changes Google made to the OAuth libraries underlying Autodrive's authentication procedure.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Jul 21, 2021)

    Changelog

    • Added more fleshed out documentation, including tutorials and guides.
    • Reworked RangeInterfaces to make them more intuitive and easy to use (also fixed a number of bugs in input parsing).
    • Added all the standard number formats used in Google Sheets' dropdown.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Jul 10, 2021)

Owner
Chris Larabee
Chris Larabee
A multipurpose, semi-modular Discord bot written in Python with the new discord.py module.

Discord.py Reaction Bot MIRAI KURIYAMA A multipurpose, semi-modular Discord bot written in Python with the new discord.py module. Installing dependenc

1 Dec 02, 2021
A simple Spamming software made in python

Spam-qlk Warning!!! 'I' am not responsible for the 'damage or harm' caused by this 'Software'!!! Use at your own risk!!! Input the message. After you

Aditya kumar 1 Nov 30, 2021
The aim is to contain multiple models for materials discovery under a common interface

Aviary The aviary contains: - roost, - wren, cgcnn. The aim is to contain multiple models for materials discovery under a common interface Environment

Rhys Goodall 20 Jan 06, 2023
This repository are used to give class about AWS

AWSTraining This repository are used to give class about AWS by Marco Antonio Pereira Linkedin: https://www.linkedin.com/in/marcoap To see the types o

Marco Antonio Pereira 6 Nov 23, 2022
Telegram bot for making Heroku app.json by @AbirHasan2005

Heroku-app.json A Telegram bot for making Heroku app.json by @AbirHasan2005. Demo Bot Host Bot Deploy to Heroku Click Below Button to Deploy to Heroku

Abir Hasan 46 Nov 13, 2022
THERE IS AN IMPOSTER AMONG US. VOTE HIM OUT BEFORE HE [ R E D A C T E D ].

🛡️ Guardian There is an impostor among us. Can you help us find out who it is? ⚙️ Installation and Usage Make sure to install Tesseract-OCR before ru

Catus Magnus 1 Jan 06, 2022
Simple VK API wrapper for Python

VK Admier: documentation VK Admier is simple VK API wrapper for community bot development. Authorization You should create bot object from Client clas

Egor Light 2 Nov 10, 2022
A Discord bot that allows you to rapidly deploy Minecraft servers seamlessly and painlessly from Discord.

Lyra - rapidly and painlessly deploy Minecraft servers from Discord Lyra lets you deploy Minecraft server instances via Docker with control through a

1 Dec 23, 2021
A.I and game for gomoku, working only on windows

Gomoku (A.I of gomoku) The goal of the project is to create an artificial intelligence of gomoku. Goals Beat the opponent. Requirements Python 3.7+ Wo

Luis Rosario 13 Jun 20, 2021
A Discord token grabber written in Python3, with awesome obfuscation and anti-debug protection.

☣️ Plague ☣️ Plague is a Discord token grabber written in Python3, obfuscated with Kramer, protected from traffic analysers with Scarecrow and using t

Billy 125 Dec 20, 2022
Based on nonebot, a common bot framework for maimai.

mai bot 使用指南 此 README 提供了最低程度的 mai bot 教程与支持。 Step 1. 安装 Python 请自行前往 https://www.python.org/ 下载 Python 3 版本( 3.7)并将其添加到环境变量(在安装过程中勾选 Add to system P

Diving-Fish 150 Jan 01, 2023
Ts-matterbridge - Integrate TeamSpeak Chat with MatterBridge

TeamSpeak-MatterBridge Bot You can use this bot to integrate TeamSpeak Chat with

4 Sep 25, 2022
A powerfull Zee5 Downloader Bot With Permeneant Thumbnail Support 💯 With Love From NexonHex

Zᴇᴇ5 DL A ᴘᴏᴡᴇʀғᴜʟʟ Zᴇᴇ5 Dᴏᴡɴʟᴏᴀᴅᴇʀ Bᴏᴛ Wɪᴛʜ Pᴇʀᴍᴇɴᴇᴀɴᴛ Tʜᴜᴍʙɴᴀɪʟ Sᴜᴘᴘᴏʀᴛ 💯 Wɪᴛʜ Lᴏᴠᴇ Fʀᴏᴍ NᴇxᴏɴHᴇx Wʜᴀᴛ Cᴀɴ I Dᴏ ? • ɪ ᴄᴀɴ Uᴘʟᴏᴀᴅ ᴀs ғɪʟᴇ/ᴠɪᴅᴇᴏ ғʀᴏᴍ

Psycharmers 4 Jan 19, 2022
🔍 Google Search unofficial API for Python with no external dependencies

Python Google Search API Unofficial Google Search API for Python. It uses web scraping in the background and is compatible with both Python 2 and 3. W

Avi Aryan 204 Dec 28, 2022
A pypi packages finder telegram bot.

PyPi-Bot A pypi packages information finder telegram bot. Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https:

Fayas Noushad 17 Oct 21, 2022
Telegram Bot for saving and sharing personal and group notes

EZ Notes Bot (ezNotesBot) Telegram Bot for saving and sharing personal and group notes. Usage Personal notes: reply to any message in PM to save it as

Dash Eclipse 8 Nov 07, 2022
Automatically send commands to send Twitch followers to any Twitch account.

Automatically send commands to send Twitch followers to any Twitch account. You just need to be in a Twitch follow bot Discord server!

Thomas Keig 6 Nov 27, 2022
Telegram Link Wayback Bot. This bot archives a web page thrown at itself with wayback Machine (Archive.org).

Telegram Link Wayback Bot. This bot archives a web page thrown at itself with wayback Machine (Archive.org).

Hüzünlü Artemis [HuzunluArtemis] 11 Feb 18, 2022
A minimal caching proxy to GitHub's REST & GraphQL APIs

github-proxy A caching forward proxy to GitHub's REST and GraphQL APIs. GitHub-Proxy is a thin, highly extensible, highly configurable python framewor

Babylon Health 26 Oct 05, 2022
Fetch torrent links from nyaa, according to releases by smoke index.

Nyaa - Smoke's index torrent fetcher Description This script parses the local (or online) anime release index (csv format) made by Big Smoke. And uses

Dinank 21 Jun 08, 2022