Created
June 13, 2022 01:08
-
-
Save ArseniyShestakov/0f2bad73bff4bc76de163629e847f6cd to your computer and use it in GitHub Desktop.
Pipedream: Google Sheets -> Supabase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { axios } from "@pipedream/platform" | |
import { createClient } from '@supabase/supabase-js' | |
import qs from 'qs'; | |
export default defineComponent({ | |
props: { | |
supabase: { | |
type: "app", | |
app: "supabase", | |
} | |
}, | |
async run({steps, $}) { | |
if (steps.trigger.event.newRow.length != 2) | |
return | |
if (steps.trigger.event.newRow[0].length < 10) | |
return | |
if (steps.trigger.event.newRow[1].length < 2) | |
return | |
const supabase = createClient(this.supabase.$auth.subdomain, this.supabase.$auth.service_key) | |
const { data, error } = await supabase | |
.from('suggestions') | |
.insert([ | |
{ | |
url: steps.trigger.event.newRow[0], | |
title: steps.trigger.event.newRow[1] | |
} | |
]) | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment