1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "spreadsheetId": "https://docs.google.com/spreadsheets/d/PASTE_YOUR_SHEET_ID_HERE/edit",
12 "rawRows": [
13 {
14 "id": 1,
15 "name": "Alice",
16 "address": {
17 "city": "Rome",
18 "zip": "00100"
19 },
20 "tags": [
21 "vip",
22 "newsletter"
23 ]
24 },
25 {
26 "id": 2,
27 "name": "Bob",
28 "address": {
29 "city": "Milan",
30 "zip": "20100"
31 },
32 "tags": []
33 },
34 {
35 "id": 2,
36 "name": "Bob",
37 "address": {
38 "city": "Milan",
39 "zip": "20100"
40 },
41 "tags": []
42 }
43 ]
44};
45
46
47const run = await client.actor("loris-barce/google-sheets-sync").call(input);
48
49
50console.log('Results from dataset');
51console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
52const { items } = await client.dataset(run.defaultDatasetId).listItems();
53items.forEach((item) => {
54 console.dir(item);
55});
56
57