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 Simple Advance Auto Filter Bot Complete Rewritten Version Of Adv-Filter-Bot

Adv Auto Filter Bot This Is Just An Simple Advance Auto Filter Bot Complete Rewritten Version Of Adv-Filter-Bot.. Just Sent Any Text As Query It Will

TeamShadow 4 Dec 10, 2021
🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Pincer An asynchronous python API wrapper meant to replace discord.py ❗ The package is currently within the planning phase 📌 Links |Join the discord

Pincer 125 Dec 26, 2022
Sie_banxico - A python class for the Economic Information System (SIE) API of Banco de México

sie_banxico A python class for the Economic Information System (SIE) API of Banco de México. Args: token (str): A query token from Banco de México id_

Dillan 2 Apr 07, 2022
A discord bot made by the community (uses python)

discord community bot context: this is a discord bot made by the community by community i mean people adding commands to the bot or changing the bot b

TR ASH 0 Oct 11, 2022
Sunflower-farmers-automated-bot - Sunflower Farmers NFT Game automated bot.IT IS NOT a cheat or hack bot

Sunflower-farmers-auto-bot Sunflower Farmers NFT Game automated bot.IT IS NOT a

Arthur Alves 17 Nov 09, 2022
My beancount practice as a template

my-beancount-template 个人 Beancount 方案的模板仓库 相关博客 复式记账指北(一):What and Why? 复式记账指北(二):做账方法论 复式记账指北(三):如何打造不半途而废的记账方案 配置 详细配置请参考博客三。必须修改的配置有: Bot功能:data/be

KAAAsS 29 Nov 29, 2022
Hack WhatsApp Account Easily(Android)

X-Whatsapp Hack WhatsApp Account Easily(Android) HOW TO RUN 👇 (Termux) pkg update && pkg upgrade pkg install python pkg install git git clone https:/

KiLL3R_xRO 72 Dec 21, 2022
A simple Python library to integrate with the Heron Data API

Heron Python This library provides easy access to the Heron Data API from applications written in Python. Documentation No language-specific docs are

Heron Data 11 Nov 11, 2022
All in one Search Engine Scrapper for used by API or Python Module. It's Free!

All in one Search Engine Scrapper for used by API or Python Module. How to use: Video Documentation Senginta is All in one Search Engine Scrapper. Wit

33 Nov 21, 2022
An alternative launcher for Lunar Client which is aimed at portability and functionality.

Portaluna An alternative launcher for Lunar Client which is aimed at portability and functionality. Features Portable. Lightweight. Functional. Note:

4 Mar 05, 2022
SmartFile API Client (Python).

A SmartFile Open Source project. Read more about how SmartFile uses and contributes to Open Source software. Summary This library includes two API cli

SmartFile 19 Jan 11, 2022
A Simple Google Translate Bot By VndGroup ❤️ Made With Python

VndGroup Google Translator Heroku Deploy ❤️ Functions This Bot Can Translate 95 Languages We Can Set Custom Language Group Support Mandatory Vars [+]

Venuja Sadew 1 Oct 09, 2022
The scope of this project will be to build a data ware house on Google Cloud Platform that will help answer common business questions as well as powering dashboards

The scope of this project will be to build a data ware house on Google Cloud Platform that will help answer common business questions as well as powering dashboards.

Shweta_kumawat 2 Jan 20, 2022
Start multiple bots using one script. VK RAID BOTNET

MultiRaidBotnet Start multiple bots using one script. VK RAID BOTNET Русский launcher.py - главный скрипт, запускающий весь ботнет config.py - в нём х

2 Jul 22, 2022
A simple but useful Discord Selfbot with essential features, made with discord.py-self.

Discord Selfbot Xyno Discord Selfbot Xyno is a simple but useful selfbot for Discord. It has currently limited useful features but it will be updated

Amit Pathak 7 Apr 24, 2022
Playing around with the slack api for learning purposes

SlackBotTest Playing around with the slack api for learning purposes and getting people to contribute Reason for this Project: Bots are very versatile

1 Nov 24, 2021
A Flask & Twilio Secret Santa app.

🎄 ✨ Secret Santa Twilio ✨ 📱 A contactless Secret Santa game built with Python, Flask and Twilio! Prerequisites 📝 A Twilio account. Sign up here ngr

Sangeeta Jadoonanan 5 Dec 23, 2021
Repositorio que contiene el material mostrado en la primera PyCON de Chile

Buenas prácticas de desarrollo en Python Repositorio que contiene el material mostrado en la primera PyCON de Chile, realizada del 5 al 7 de Noviembre

Erick Castillo 5 Feb 01, 2022
Bearer API client for Python

Bearer Python Bearer Python client Installation pip install bearer Usage Get your Bearer Secret Key and integration id from the Dashboard and use the

Bearer 9 Oct 31, 2022
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using async and await

Senpai Development 4 Nov 05, 2021