Reputation: 2595
Everyday I get some data into a Google Sheet, the data from today overwrites the data from yesterday.
I created a BigQuery table based on this Google Sheet - initial connection works and the data from the sheet can be correctly queried in BigQuery.
Q: Tomorrow the data in Google Sheet will be overwritten. How can I append everyday data from Google Sheet to BigQuery so, that I have in BigQuery data from everyday consecutively, like archived?
I didn't found any tutorial for such task - everything I found is about connecting Google Sheets to BigQuery and getting data from one to another, but not about a kind of archiving.
Upvotes: 0
Views: 1858
Reputation: 2595
As often, immediately after I post a question I get an answer by myself.
The trick is the workflow:
SELECT * FROM 'myproject.mydataset.mytable' LIMIT 10
,Upvotes: 1
Reputation: 1849
If you are using an external table to query the Google Sheet, the BigQuery not store the table, so the data will reflect the current state of the sheet.
An option is create a native BigQuery table to store the data and use the BigQuery Scheduled Queries to run a query that get the data from the external table and insert into the native one. Something like this:
INSERT INTO `project.dataset.native_table`
SELECT * FROM `project.dataset.sheets_external_table`
Upvotes: 1