Skip to main content

No project description provided

Project description

Description

This Library lets you export 2D array of data into your Google Spreadsheet.

  • In short;

    • Before


    ![Empty SpreadSheet](https://i.imgur.com/fU64iks.png)

    - After export of `[["Name"],["David"]]`

    ![SpreadSheet with data](https://i.imgur.com/341Kbkl.png)

The following code snippet will export "Name" and "David" into your Google Spreadsheet, assuming you are all set up on the Google Cloud side.

If this is not the case, continue to the section 'Complete Guide'

Quickstart:

Install the library by running pip install google-spreadsheets-exporter

Include the following code snippet for desired functionality

  from pathlib import Path
  from google_spreadsheets_exporter.exporter import Exporter
    
  BASE_DIR = Path(__file__).resolve() # adjust path to your credentials file filder as needed
  data = [["Name"],["David"]]
    
  exp = Exporter("spreadsheet-id", "sheet-name", data, credentials_file_full_path=os.path.join(BASE_DIR, "creds.json"))
  exp.export()

Complete Guide

  • Step 1: Set up a Google Sheets API Project

    • Go to the Google Developers Console (https://console.developers.google.com/) and create a new project.
      • A user for this project has to be created. Note its email.
    • Enable the Google Sheets API for your project.
    • Create credentials for your project to access the API. For this purpose, you'll need a service account key, which is a JSON file containing authentication information.
    • The credentials JSON file should be downloaded and included in your project.
  • Step 2:

    • Create a Google sheet from your account
    • Note down Spreadsheet ID
      • eg https://docs.google.com/spreadsheets/d/spreadsheetId-sdvs-dsv/edit#gid=0/
    • Share the Spreadsheet with the email of your newly created Google project user.
  • Step 3: Include this code snippet in you project

    • Install the library by running pip install google-spreadsheets-exporter

      Include the following code snippet for desired functionality

      from pathlib import Path
      from google_spreadsheets_exporter.exporter import Exporter
      
      BASE_DIR = Path(__file__).resolve() # adjust path to your credentials file filder as needed
      data = [["Name"],["David"]]
      
      exp = Exporter("spreadsheet-id", "sheet-name", data, credentials_file_full_path=os.path.join(BASE_DIR, "creds.json"))
      exp.export()
      
      

    where spreadsheet-id and sheet-name has been extracted from Spreadsheet url, data is 2D python array and credentials_file_full_path is full path to your credentials file.

Happy exporting.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_spreadsheets_exporter-0.3.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_spreadsheets_exporter-0.3.2-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file google_spreadsheets_exporter-0.3.2.tar.gz.

File metadata

File hashes

Hashes for google_spreadsheets_exporter-0.3.2.tar.gz
Algorithm Hash digest
SHA256 ec3a20f3f56fb9ac22d36239515d10c58846332600ce3c4e8970b7e5411e5c6a
MD5 b4f443d0cd9aaf53e0fa92b3ba45099b
BLAKE2b-256 06f3eb2a5a7f12a8d54b0238acdff51c45f81538a21fbf249a6fb0cae362698b

See more details on using hashes here.

File details

Details for the file google_spreadsheets_exporter-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for google_spreadsheets_exporter-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5de53f8853adf0fc284fb2d25ab8ad32472efd9522709d66ea7a063ad216995b
MD5 d2fad2bc210bca58a37aa5a4a56577e4
BLAKE2b-256 de5c3dde9874cce3224696f94614c322e4e3c76bdd257323611880edaa092248

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page