From ff565c82362e2bdde212010be110ec247d6da8e1 Mon Sep 17 00:00:00 2001 From: Archie Wood <58074498+archiewood@users.noreply.github.com> Date: Fri, 25 Oct 2024 00:11:14 -0400 Subject: [PATCH] add test --- test/sql/copyto.test | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/sql/copyto.test diff --git a/test/sql/copyto.test b/test/sql/copyto.test new file mode 100644 index 0000000..3f4b867 --- /dev/null +++ b/test/sql/copyto.test @@ -0,0 +1,35 @@ +# name: test/sql/copyto.test +# description: test COPY TO function +# group: [gsheets] + +require-env TOKEN + +require gsheets + +# Create a secret NB must substitute a token, do not commit! +statement ok +create secret test_secret (type gsheet, token '${TOKEN}'); + +# Create a table to copy to Google Sheet +statement ok +create table spreadsheets as +select 'Microsoft' as company, 'Excel' as product, 1985 as year_founded +union all +select 'Google', 'Google Sheets', 2006 +union all +select 'Apple', 'Numbers', 1984 +union all +select 'LibreOffice', 'Calc', 2000; + +# Copy the table to Google Sheet +statement ok +copy spreadsheets to 'https://docs.google.com/spreadsheets/d/11QdEasMWbETbFVxry-SsD8jVcdYIT1zBQszcF84MdE8/edit#gid=0' (format gsheet); + +# Read the table from Google Sheet +query III +from read_gsheet('https://docs.google.com/spreadsheets/d/11QdEasMWbETbFVxry-SsD8jVcdYIT1zBQszcF84MdE8/edit#gid=0'); +---- +Microsoft Excel 1985 +Google Google Sheets 2006 +Apple Numbers 1984 +LibreOffice Calc 2000