Coder Social home page Coder Social logo

charlie-hill / python-extract-spreadsheet-and-seed-supabase-table Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 24.5 MB

An example project to show how you can use Python to extract data from a spreadsheet and use the extracted data to seed a Supabase database table

Shell 1.15% Python 98.85%
educational open-finance open-source python simple stock-market stock-market-data supabase ticker-data ticker-symbols

python-extract-spreadsheet-and-seed-supabase-table's Introduction

Python XLSX extractor & Supabase table seed example

This project is a crude example of how you can use Python to extract data from an Excel spreadsheet (.xlsx) and then seed a Supabase database table with the extracted data.

The spreadsheet example used in this project is equity instrument data from the London Stock Exchange. Simply put, the data is list of tradable securities (such as stocks, bonds & ETFs) on the London Stock Exchange.


Setup, Install & Use

Prerequisites

You will need to be able to setup a simple Supabase database and have the URL & KEY ready.


Setup

After you have cloned the repository:

  • Install required Python packages: pip install -r requirements.txt
  • Copy the .env.example file contents into a new file called .env
  • Alter the SUPABASE_URL & SUPABASE_KEY to your respective Supabase database values

Extract data from spreadsheet

Run python ./main.py and once it has completed you should now see headings.txt and instruments.json

  • headings.txt: A text file containing the column headings relative to the spreadsheet data. You can use these to create the table column names in the database.
  • instruments.json: Each of the spreadsheet rows formatted into JSON, this will be used to seed the database

Supabase Table Setup

  • Add a table named lse_instruments and create the respective columns from headings.txt
  • Note:
    • The TIDM column should be set as the primary key
    • For simplicity add all of the columns as a text datatype and allow each of them to be nullable

Seed Supabase table with extracted spreadsheet data

  • Finally to seed the newly created table with the data extracted from the Spreadsheet simply run python ./seed.py and wait for it to complete

Once these steps have been completed you should now be able to browse to your Supabase table on the web ui and see the populated data.

python-extract-spreadsheet-and-seed-supabase-table's People

Contributors

charlie-hill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.