抱歉,您的瀏覽器無法訪問本站
本頁面需要瀏覽器支持(啟用)JavaScript
了解詳情 >

延續上一章,完成 Google 相關服務的憑證申請與設定後,就能在 workflow 中讀取、寫入 Google Sheets。

1. 建立工作流並且新增節點

第 1/9 步: Create workflow

第 2/9 步: 為工作流命名

① 將 workflow 命名為「ReadGoogleSheet」。

第 3/9 步: 點擊 "+" icon 打開 Nodes panel

第 4/9 步: 搜尋 Manual Trigger 節點

① 於 Nodes panel 搜尋 「Manual Trigger」。
② 在搜尋結果中點擊「Manual Trigger」。

第 5/9 步: 對著 Trigger node 點擊右鍵打開控制面板

① 對著 Trigger node 點擊右鍵打開控制面板。
② 選擇「Rename」功能。

第 6/9 步: 重新命名該節點為 clickBtn

① 將該節點重新命名為「clickBtn」。

第 7/9 步: 點擊 「clickBtn」 的延伸線 「+」 符號,新增下一個節點

① 點擊「clickBtn」延伸線上的「+」,新增下一個節點。
② 在搜尋介面輸入「Google Sheets」。
③ 點擊 「Google Sheets」進入下一層選單。

第 8/9 步: 選擇 Get row(s)

① 點擊 「Get row(s)」建立節點。

第 9/9 步: 將 Google Sheets node 重新命名

① 將該節點重新命名為「ReadGoogleSheet」。

進到下一個部分

接下來進入下一部分,將測試用的 Excel 檔案上傳到雲端硬碟。

2. 上傳 Excel 檔案並轉換為 Google Sheet

第 1/4 步: 下載範例 Excel 檔

請從以下連結下載範例 Excel:範例檔案

第 2/4 步: 上傳範例檔案至雲端硬碟

注意!
① 請將要給 n8n 讀取的 Excel 檔案,上傳到 Google 雲端硬碟。
② 建議在雲端硬碟上建立 n8n 使用的資料夾。

請上傳至已連結 Google 帳號所屬的雲端硬碟,否則會因為授權問題無法讀取,如果不確定目前綁定的是哪個帳號,可到 Credential 設定頁面重新綁定或切換帳號。

第 3/4 步: 在雲端硬碟將 Excel 轉為 Google Sheet

① 使用瀏覽器開啟剛上傳的 Excel 檔案。

② 從選單列 ⮕ 檔案 ⮕ 選擇「儲存為 Google 試算表」。

注意

透過 n8n Google Sheet 節點進行新增/讀取/刪除/更新動作時,目標必須是 Google Sheets 格式;Excel 無法透過此節點讀取或編輯,因為該節點是走 Google Sheets API,不支援 Excel 檔。

第 4/4 步: 確認格式並且複製 Google Sheet 連結

① 複製瀏覽器網址列中的連結。

提示
Excel 轉成 Google Sheet 時會保留原始檔,可視需要再刪除 Excel。

進到下一階段:回到 n8n 節點設定畫面

回到 n8n 的 ReadGoogleSheet 節點設定畫面,繼續完成工作流。

3. 設定 n8n 的 ReadGoogleSheet 節點

第 1/3 步: 設定 ReadGoogleSheet 節點

Operation 選擇 Get row(s)
Document 欄位左側欄 (目標類型) 選擇 By URL
Document 欄位右側欄填入第 2 節第 4 步複製的 Google Sheet 網址。
Sheet 左側欄位預設使用 From list,右側下拉式選單選擇目標讀取的分頁 (範例是tsmc)。

注意
如果在設定 Sheet 欄位時出現以下提示,表示目前的 Credential 有問題。可先到 Credential 設定畫面重新登入。

上述問題有兩種可能:
① Credential 本身設定有問題,即 n8n 與 Google Cloud 之間的連線有問題。
② n8n 使用者要讓 n8n 存取自己帳號的檔案,會透過 OAuth2 方式進行連線,OAuth2 的憑證過期,在 Google Cloud Project 測試使用者身份下,該憑證有效期限為 7 天,即每 7 天要重新透過 Credential 的 Sign in with Google 按鈕重新登入。

第 2/3 步: 執行 ReadGoogleSheet 節點

① 完成參數設定後,點擊 Execute step 嘗試取得 Google Sheet 資料。
② 確認 Output 欄位有資料出現。
③ 點選 Output 區域右上角的 Pin,將輸出資料固定下來。 釘選資料的按鈕 Pin 可能會因為畫面大小被遮擋,該按鈕位於 Output 區域最右側。

第 3/3 步:檢視 ReadGoogleSheet 節點 Output 資料

Output 區域會把該節點取得或是處理完成的資料使用三種方式呈現,分別是 Schema、Table、JSON 格式。

① Schema 格式:顯示輸出資料的欄位結構與資料型別,方便了解可使用的欄位。使用時機:確認欄位、建立 Expression、串接下一節點。


② Table 格式:以表格呈現多筆 Item 的欄位與資料,方便快速查看與比對。使用時機:查看大量資料、檢查欄位值、除錯資料流程。

③ JSON 格式:以 JSON 階層結構呈現完整輸出資料,包含巢狀物件與陣列。使用時機:處理 API、撰寫 Expression、確認完整資料結構。

進到下一個資料處理節點

關閉 ReadGoogleSheet 節點的參數設定,回到 n8n 的 Canvas,繼續新增節點。

4. 加入 Filter 節點過濾資料列

從 Google Sheets 的工作表取得資料後,從 Schema 可看出欄位未被辨識成「日期、成交股數」等名稱,而是 col_1col_2,且資料中還夾雜表頭與說明列,因此先用下一個節點過濾。

第 1/7 步: 在 ReadGoogleSheet 節點延伸線後加入新節點

第 2/7 步: Nodes panel 搜尋 Filter 關鍵字

① 於 Nodes panel 搜尋欄位處輸入 Filter 關鍵字。
② 在搜尋結果中選擇 Filter 節點,將它加到 Canvas。

第 3/7 步:設定 Filter 過濾條件 ①

① 將 Input 切換到 Schema 分頁。
② 拖曳 col_1 到 Conditions 區域的 value1 欄位。
③ 點擊 operator 下拉式選單 ⮕ 第一層選項選擇 String ⮕ 第二層選項選擇 is not equal to

您應該要知道:

value1 通常擺放被比較變數。
② 中間是運算子(operator),用來比較 value1value2;不同資料型別會有不同分類(例如 is equal toStringNumber 底下都有)。
value2 是比較數,可以是變數、固定值、字串、數值或是布林值等。

第 4/7 步:設定 Filter 過濾條件 ②

Value2 輸入 日期
② 點擊 Add condition 新增下一個 condition 區域。

第 5/7 步:設定 Filter 過濾條件 ③

① 兩個 condition 之間的邏輯請選擇 AND(僅有 ANDOR)。
② 拖曳 col_1 到第二個 Conditions 區域的 value1 欄位。
③ 點擊 operator 下拉式選單 ⮕ 第一層選項選擇 String ⮕ 第二層選項選擇 is not equal to
Value2 輸入 說明:

第 6/7 步:重複新增 Condition 區域,直到所有濾除條件填寫完成

value1operatorvalue2
$json.col_1is not equal to日期
$json.col_1is not equal to說明:
$json.col_1is not equal to符號說明:+/-/X表示漲/跌/不比價
$json.col_1is not equal to當日統計資訊含一般、零股、盤後定價,不含鉅額、拍賣、標購。
$json.col_1is not equal toETF證券代號第六碼為K、M、S、C者,表示該ETF以外幣交易。

第 7/7 步:確認 Filter 節點的輸出並且固定輸出

① 按下 Execute step 按鈕。
② Output 區域選擇 Table 欄位。
③ 選擇 Kept 分頁。
④ 確認資料是否正確被過濾。
⑤ 點選 Output 區域右上角的 Pin,將輸出資料固定下來。

您應該要知道

Filter 節點會把 Input 分成兩類輸出 KeptDiscarded
其中 Kept 是通過過濾、會傳到下一節點的資料;Discarded 則是被濾除、不會往下傳的資料。

進到下一個資料處理節點

固定好 Filter 節點輸出後,進入到下一個節點進行欄位映射。

5. 加入 Edit Fields (Set) 節點編排欄位資料

接下來我們可以透過 Edit Fields (Set) 進行新增、修改、刪除或重新命名資料欄位,整理節點輸出內容,建立後續流程需要的資料格式。

第 1/4 步: 在 Filter 節點延伸線後加入新節點

① 在 Filter 節點延伸線後加入新節點
② 於 Nodes panel 搜尋欄位處輸入 Edit Fields 關鍵字。
③ 在搜尋結果中選擇 Edit Fields (Set) 節點,將它加到 Canvas。

第 2/4 步:重新命名節點為 FormatSheetData

Edit Fields (Set) 更名為 FormatSheetData
Mode 選擇 Manual Mapping
③ 點擊 Drop input fields here or Add Field

第 3/4 步:設定欄位名稱與值

① Input 區域的 col_1 拖曳至 Parameters 的 Fields to Set 區域 value 輸入框。
② Parameters 的 Fields to Set 區域 name 輸入文字 日期
③ 拖曳 col_2Drop input fields here or Add Field

您應該要知道

name 欄位的值會成為 JSON 物件的 key。
type 是這個鍵值所用的資料型別,可為 StringNumberBooleanArrayObjectBinary Data
value 會成為 JSON 的值,通常是變數。若改打固定文字,所有 item 都會是同一個值。例如 name 設為 statusvalue 輸入 1,每個 item 都會有 status: "1"

第 4/4 步:完成欄位名稱與值的對應

nametypevalue
日期String$json.col_1
成交股數Number$json.col_2
成交金額Number$json.col_3
開盤價Number$json.col_4
最高價Number$json.col_5
最低價Number$json.col_6
收盤價Number$json.col_7
漲跌價差String$json.col_8
成交筆數Number$json.col_9

① 完成後點擊 Execute step 按鈕 (也可以每完成一個欄位就執行一次,觀察輸出)。
② 在 Output 檢視結果是否正確。

完成

6. 節點另一種寫法與延伸

6.1. Filter 改為使用正則表達式

實際上,第 4 節的 Filter 是針對 col_1 文字出現的組合進行過濾,之後若再出現新的說明文字,就得回頭改 Filter、加規則。可以改從「要保留的資料長什麼樣子」來想,改用正則表達式:符合格式的列才留下。

第 1/3 步: 建立 Filter 節點

建立 Filter 節點,步驟如同第 4 節的步驟 1 ~ 2。

第 2/3 步: 將 Filter 節點命名,並設定 Conditions 參數

① 將節點命名為 RegexFilter (在一個工作流中節點名稱不能重複)。
② 將 Input 區域的 col_1 拖曳至 Conditions 區域的 value1 欄位。
Operator 展開下拉式選單 ⮕ 第一層選單選擇 String ⮕ 第二層選單選擇 matches regex

第 3/3 步: 輸入正則表達式並執行

① 滑鼠移動到 Conditions 區域的 value2 輸入欄位。
② 選擇設定欄位內容為 Expression 模式。
③ 輸入字串 ^\d{4}/\d{2}/\d{2}$
④ 點擊 Execute step 觀察輸出。

完成

透過正則表達式 (Regular Expression) 作為過濾條件,這樣就不必再重複第 4 節步驟 4~6 那一長串條件。
另外使用正則表達式進行過濾,可以只專注要保留下來的資料樣式,即便之後 col_1 加入其他說明字串,也不會影響過濾結果。

6.2. Edit Fields (Set) 欄位對應使用 JSON 程式碼表示

若對程式碼有一定理解,FormatSheetData 節點也可以改用 JSON 設定。

第 1/2 步: 建立 Edit Fields (Set) 節點

建立 Edit Fields (Set) 節點,步驟如同第 5 節的步驟 1 。

第 2/2 步: 改用 JSON 模式並貼上程式碼

Edit Fields (Set) 節點命名為 FormatDataByJSON
Mode 選擇 JSON
JSON 欄位輸入以下程式碼

1
2
3
4
5
6
7
8
9
10
11
{
"日期": "{{ $json.col_1 }}",
"成交股數": {{ $json.col_2 }},
"成交金額": {{ $json.col_3 }},
"開盤價": {{ $json.col_4 }},
"最高價": {{ $json.col_5 }},
"最低價": {{ $json.col_6 }},
"收盤價": {{ $json.col_7 }},
"漲跌價差": "{{ $json.col_8 }}",
"成交筆數": {{ $json.col_9 }}
}

④ 點擊 Execute step 按鈕並觀察輸出結果

完成

若熟悉 JavaScript 與 JSON,可直接用 JSON 定義欄位,省下不少點選操作。

注意

Edit fields (Set) 節點切換 Mode 時,會把另一個 mode 下的參數設定清除,切換 Mode 前,建議先複製該節點,以免另一種模式的設定被清掉。

7. Workflow 的 JSON 程式碼

n8n workflow 原始碼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
{
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-896,
-128
],
"id": "a51a72f1-f814-4f02-bb51-48c7d375c1ac",
"name": "clickBtn"
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1q_CP797bHvHpS2Hx9-fEKPfBBMQlORNULn7ZCJ8-W10/edit?gid=2098096419#gid=2098096419",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": 2098096419,
"mode": "list",
"cachedResultName": "tsmc",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1q_CP797bHvHpS2Hx9-fEKPfBBMQlORNULn7ZCJ8-W10/edit#gid=2098096419"
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
-672,
-128
],
"id": "1f277da0-c053-4cbf-ada5-52eb9f54d973",
"name": "ReadGoogleSheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "sVsDpnPWEutPF34r",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "c9939592-f374-45a4-bd2f-eab770f3fa5b",
"leftValue": "=",
"rightValue": "日期",
"operator": {
"type": "string",
"operation": "notEquals"
}
},
{
"id": "d35119cd-1152-461c-bc31-0cc347a94c83",
"leftValue": "=",
"rightValue": "說明:",
"operator": {
"type": "string",
"operation": "notEquals"
}
},
{
"id": "1d826769-123b-45ab-8713-4893adfe3c24",
"leftValue": "=",
"rightValue": "符號說明:+/-/X表示漲/跌/不比價",
"operator": {
"type": "string",
"operation": "notEquals"
}
},
{
"id": "64b94f39-90da-44f8-9023-ca8955f33c5d",
"leftValue": "=",
"rightValue": "當日統計資訊含一般、零股、盤後定價,不含鉅額、拍賣、標購。",
"operator": {
"type": "string",
"operation": "notEquals"
}
},
{
"id": "f0e4065b-501c-45e0-a336-014e39aec94d",
"leftValue": "=",
"rightValue": "ETF證券代號第六碼為K、M、S、C者,表示該ETF以外幣交易。",
"operator": {
"type": "string",
"operation": "notEquals"
}
}
],
"combinator": "and"
},
"looseTypeValidation": "=",
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.3,
"position": [
-448,
-32
],
"id": "4c4e0571-be1d-4158-9fc1-9625dc6607f8",
"name": "Filter"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "386c4a1c-4b1b-444b-b01c-d2411fc3bb64",
"name": "日期",
"value": "=",
"type": "string"
},
{
"id": "394fc653-b2da-4362-b6d9-d8f8934a9cde",
"name": "成交股數",
"value": "=",
"type": "number"
},
{
"id": "9a09c605-6883-4c42-9d68-3f2c131e96aa",
"name": "成交金額",
"value": "=",
"type": "number"
},
{
"id": "9e5c6ced-26a7-43da-b12e-ad0ea3ac5718",
"name": "開盤價",
"value": "=",
"type": "number"
},
{
"id": "c11c71dd-f010-46e4-befe-d250239d610d",
"name": "最高價",
"value": "=",
"type": "number"
},
{
"id": "53d50e44-3f46-46d8-a46c-93b3aca9e51f",
"name": "最低價",
"value": "=",
"type": "number"
},
{
"id": "e7cde3f9-decc-420b-8a49-ad6204812a42",
"name": "收盤價",
"value": "=",
"type": "number"
},
{
"id": "5566e0ab-8c46-42c5-be21-b3b4fedaac42",
"name": "漲跌價差",
"value": "=",
"type": "string"
},
{
"id": "c18a1d17-bfaa-4dd3-a935-290ff1618cfd",
"name": "成交筆數",
"value": "=",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.5,
"position": [
-224,
-32
],
"id": "4f7998d4-3cda-4287-acdd-e3e40253d494",
"name": "FormatSheetData"
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "={\n \"日期\": \"\",\n \"成交股數\": ,\n \"成交金額\": ,\n \"開盤價\": ,\n \"最高價\": ,\n \"最低價\": ,\n \"收盤價\": ,\n \"漲跌價差\": \"\",\n \"成交筆數\": \n}\n ",
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.5,
"position": [
-224,
-224
],
"id": "8fe9b80b-5c4e-4bf0-9a5f-6b259fc4c29f",
"name": "FormatDataByJSON"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "f0e4065b-501c-45e0-a336-014e39aec94d",
"leftValue": "=",
"rightValue": "=^\\d{4}/\\d{2}/\\d{2}$",
"operator": {
"type": "string",
"operation": "regex"
}
}
],
"combinator": "and"
},
"looseTypeValidation": "=",
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.3,
"position": [
-448,
-224
],
"id": "f824052e-72f2-47f1-9b7e-9be71d1e10e6",
"name": "RegexFilter"
},
{
"parameters": {
"content": "## 觸發器\n一個工作流的開始,需要 Trigger。這邊採用 Manual Trigger 做為「測試」時的觸發器。",
"height": 320,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-928,
-304
],
"typeVersion": 1,
"id": "e5fb5c6d-9823-4024-9dc2-d47a2139149a",
"name": "Sticky Note"
},
{
"parameters": {
"content": "## 讀取目標 Sheet\n1. 設定 Credential\n2. 設定文件 URL\n3. 設定讀取工作表",
"height": 320,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
-304
],
"typeVersion": 1,
"id": "99e43bfb-482e-4c8b-ade7-8f2717c7586a",
"name": "Sticky Note5"
},
{
"parameters": {
"content": "## Filter 過濾資料\n1. 指定過濾欄位\n2. 設定過濾條件\n3. 也可以使用 Regex 過濾\n",
"height": 288,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
-384
],
"typeVersion": 1,
"id": "e96a4e95-c412-4c66-aaee-5fd390f44e82",
"name": "Sticky Note3"
},
{
"parameters": {
"content": "\n\n\n\n\n\n## Filter 過濾資料\n1. 指定過濾欄位\n2. 設定過濾條件",
"height": 272,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
-64
],
"typeVersion": 1,
"id": "eb983ceb-d0fc-47d7-9133-697eb3fde902",
"name": "Sticky Note2"
},
{
"parameters": {
"content": "## Edit Field (Set)\n用來重新編排資料格式 ",
"height": 592,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-256,
-384
],
"typeVersion": 1,
"id": "9a0bf0d9-a848-4dac-b02f-c719c5948016",
"name": "Sticky Note4"
},
{
"parameters": {
"content": "## 後續\n之後節點就按照自己當前的應用場景進行規劃與串接\n",
"height": 608,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
-384
],
"typeVersion": 1,
"id": "db33c902-6f12-466f-a19d-67b72cbf5973",
"name": "Sticky Note1"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"mode": "list",
"value": ""
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": ""
}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
16,
-256
],
"id": "b6615cfb-b865-449b-a3ae-f441a21ad6c9",
"name": "Append row in sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "sVsDpnPWEutPF34r",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"method": "POST",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.5,
"position": [
16,
-80
],
"id": "88ce56cc-3f11-4b1f-b1ff-417c8b96f9c2",
"name": "HTTP Request"
},
{
"parameters": {
"language": "pythonNative",
"pythonCode": "# Loop over input items and add a new field called 'my_new_field' to the JSON of each one\nfor item in _items:\n item[\"json\"][\"my_new_field\"] = 1\nreturn _items"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
16,
96
],
"id": "c146b5fe-1375-45d4-abf0-87e688474b2c",
"name": "Code in Python"
}
],
"connections": {
"clickBtn": {
"main": [
[
{
"node": "ReadGoogleSheet",
"type": "main",
"index": 0
}
]
]
},
"ReadGoogleSheet": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
},
{
"node": "RegexFilter",
"type": "main",
"index": 0
}
]
]
},
"Filter": {
"main": [
[
{
"node": "FormatSheetData",
"type": "main",
"index": 0
}
]
]
},
"RegexFilter": {
"main": [
[
{
"node": "FormatDataByJSON",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {
"ReadGoogleSheet": [
{
"row_number": 2,
"col_1": "日期",
"col_2": "成交股數",
"col_3": "成交金額",
"col_4": "開盤價",
"col_5": "最高價",
"col_6": "最低價",
"col_7": "收盤價",
"col_8": "漲跌價差",
"col_9": "成交筆數",
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 3,
"col_1": "0111/07/01",
"col_2": 72597018,
"col_3": 33459624760,
"col_4": 471.5,
"col_5": 474,
"col_6": 452.5,
"col_7": 453.5,
"col_8": -22.5,
"col_9": 172267,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 4,
"col_1": "0111/07/04",
"col_2": 61206245,
"col_3": 27225872277,
"col_4": 443,
"col_5": 451.5,
"col_6": 440,
"col_7": 440,
"col_8": -13.5,
"col_9": 96760,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 5,
"col_1": "0111/07/05",
"col_2": 55469884,
"col_3": 24538415224,
"col_4": 449.5,
"col_5": 451.5,
"col_6": 433,
"col_7": 446,
"col_8": "+6.00",
"col_9": 70715,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 6,
"col_1": "0111/07/06",
"col_2": 42156925,
"col_3": 18556660847,
"col_4": 442,
"col_5": 447.5,
"col_6": 435,
"col_7": 435.5,
"col_8": -10.5,
"col_9": 59018,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 7,
"col_1": "0111/07/07",
"col_2": 50984110,
"col_3": 22992311966,
"col_4": 442,
"col_5": 459,
"col_6": 438.5,
"col_7": 457.5,
"col_8": "+22.00",
"col_9": 56227,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 8,
"col_1": "0111/07/08",
"col_2": 39134398,
"col_3": 18251251558,
"col_4": 470,
"col_5": 470.5,
"col_6": 461.5,
"col_7": 467,
"col_8": "+9.50",
"col_9": 46039,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 9,
"col_1": "0111/07/11",
"col_2": 22930675,
"col_3": 10673806551,
"col_4": 468,
"col_5": 470.5,
"col_6": 461,
"col_7": 462,
"col_8": -5,
"col_9": 25631,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 10,
"col_1": "0111/07/12",
"col_2": 24155935,
"col_3": 10932798847,
"col_4": 458,
"col_5": 458,
"col_6": 449.5,
"col_7": 449.5,
"col_8": -12.5,
"col_9": 34431,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 11,
"col_1": "0111/07/13",
"col_2": 48134139,
"col_3": 22639696871,
"col_4": 470.5,
"col_5": 473,
"col_6": 466,
"col_7": 470.5,
"col_8": "+21.00",
"col_9": 48964,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 12,
"col_1": "0111/07/14",
"col_2": 34014188,
"col_3": 16045789881,
"col_4": 466,
"col_5": 477.5,
"col_6": 463,
"col_7": 475,
"col_8": "+4.50",
"col_9": 36454,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 13,
"col_1": "0111/07/15",
"col_2": 56039339,
"col_3": 27285128552,
"col_4": 481,
"col_5": 494,
"col_6": 477,
"col_7": 492.5,
"col_8": "+17.50",
"col_9": 63691,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 14,
"col_1": "0111/07/18",
"col_2": 39878601,
"col_3": 19689642282,
"col_4": 495.5,
"col_5": 498.5,
"col_6": 488.5,
"col_7": 495.5,
"col_8": "+3.00",
"col_9": 42566,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 15,
"col_1": "說明:",
"col_2": "",
"col_3": "",
"col_4": "",
"col_5": "",
"col_6": "",
"col_7": "",
"col_8": "",
"col_9": "",
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 16,
"col_1": "符號說明:+/-/X表示漲/跌/不比價",
"col_2": "",
"col_3": "",
"col_4": "",
"col_5": "",
"col_6": "",
"col_7": "",
"col_8": "",
"col_9": "",
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 17,
"col_1": "當日統計資訊含一般、零股、盤後定價,不含鉅額、拍賣、標購。",
"col_2": "",
"col_3": "",
"col_4": "",
"col_5": "",
"col_6": "",
"col_7": "",
"col_8": "",
"col_9": "",
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 18,
"col_1": "ETF證券代號第六碼為K、M、S、C者,表示該ETF以外幣交易。",
"col_2": "",
"col_3": "",
"col_4": "",
"col_5": "",
"col_6": "",
"col_7": "",
"col_8": "",
"col_9": "",
"111年07月 2330 台積電 各日成交資訊": ""
}
],
"Filter": [
{
"row_number": 3,
"col_1": "0111/07/01",
"col_2": 72597018,
"col_3": 33459624760,
"col_4": 471.5,
"col_5": 474,
"col_6": 452.5,
"col_7": 453.5,
"col_8": -22.5,
"col_9": 172267,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 4,
"col_1": "0111/07/04",
"col_2": 61206245,
"col_3": 27225872277,
"col_4": 443,
"col_5": 451.5,
"col_6": 440,
"col_7": 440,
"col_8": -13.5,
"col_9": 96760,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 5,
"col_1": "0111/07/05",
"col_2": 55469884,
"col_3": 24538415224,
"col_4": 449.5,
"col_5": 451.5,
"col_6": 433,
"col_7": 446,
"col_8": "+6.00",
"col_9": 70715,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 6,
"col_1": "0111/07/06",
"col_2": 42156925,
"col_3": 18556660847,
"col_4": 442,
"col_5": 447.5,
"col_6": 435,
"col_7": 435.5,
"col_8": -10.5,
"col_9": 59018,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 7,
"col_1": "0111/07/07",
"col_2": 50984110,
"col_3": 22992311966,
"col_4": 442,
"col_5": 459,
"col_6": 438.5,
"col_7": 457.5,
"col_8": "+22.00",
"col_9": 56227,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 8,
"col_1": "0111/07/08",
"col_2": 39134398,
"col_3": 18251251558,
"col_4": 470,
"col_5": 470.5,
"col_6": 461.5,
"col_7": 467,
"col_8": "+9.50",
"col_9": 46039,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 9,
"col_1": "0111/07/11",
"col_2": 22930675,
"col_3": 10673806551,
"col_4": 468,
"col_5": 470.5,
"col_6": 461,
"col_7": 462,
"col_8": -5,
"col_9": 25631,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 10,
"col_1": "0111/07/12",
"col_2": 24155935,
"col_3": 10932798847,
"col_4": 458,
"col_5": 458,
"col_6": 449.5,
"col_7": 449.5,
"col_8": -12.5,
"col_9": 34431,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 11,
"col_1": "0111/07/13",
"col_2": 48134139,
"col_3": 22639696871,
"col_4": 470.5,
"col_5": 473,
"col_6": 466,
"col_7": 470.5,
"col_8": "+21.00",
"col_9": 48964,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 12,
"col_1": "0111/07/14",
"col_2": 34014188,
"col_3": 16045789881,
"col_4": 466,
"col_5": 477.5,
"col_6": 463,
"col_7": 475,
"col_8": "+4.50",
"col_9": 36454,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 13,
"col_1": "0111/07/15",
"col_2": 56039339,
"col_3": 27285128552,
"col_4": 481,
"col_5": 494,
"col_6": 477,
"col_7": 492.5,
"col_8": "+17.50",
"col_9": 63691,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 14,
"col_1": "0111/07/18",
"col_2": 39878601,
"col_3": 19689642282,
"col_4": 495.5,
"col_5": 498.5,
"col_6": 488.5,
"col_7": 495.5,
"col_8": "+3.00",
"col_9": 42566,
"111年07月 2330 台積電 各日成交資訊": ""
}
],
"RegexFilter": [
{
"row_number": 3,
"col_1": "0111/07/01",
"col_2": 72597018,
"col_3": 33459624760,
"col_4": 471.5,
"col_5": 474,
"col_6": 452.5,
"col_7": 453.5,
"col_8": -22.5,
"col_9": 172267,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 4,
"col_1": "0111/07/04",
"col_2": 61206245,
"col_3": 27225872277,
"col_4": 443,
"col_5": 451.5,
"col_6": 440,
"col_7": 440,
"col_8": -13.5,
"col_9": 96760,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 5,
"col_1": "0111/07/05",
"col_2": 55469884,
"col_3": 24538415224,
"col_4": 449.5,
"col_5": 451.5,
"col_6": 433,
"col_7": 446,
"col_8": "+6.00",
"col_9": 70715,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 6,
"col_1": "0111/07/06",
"col_2": 42156925,
"col_3": 18556660847,
"col_4": 442,
"col_5": 447.5,
"col_6": 435,
"col_7": 435.5,
"col_8": -10.5,
"col_9": 59018,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 7,
"col_1": "0111/07/07",
"col_2": 50984110,
"col_3": 22992311966,
"col_4": 442,
"col_5": 459,
"col_6": 438.5,
"col_7": 457.5,
"col_8": "+22.00",
"col_9": 56227,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 8,
"col_1": "0111/07/08",
"col_2": 39134398,
"col_3": 18251251558,
"col_4": 470,
"col_5": 470.5,
"col_6": 461.5,
"col_7": 467,
"col_8": "+9.50",
"col_9": 46039,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 9,
"col_1": "0111/07/11",
"col_2": 22930675,
"col_3": 10673806551,
"col_4": 468,
"col_5": 470.5,
"col_6": 461,
"col_7": 462,
"col_8": -5,
"col_9": 25631,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 10,
"col_1": "0111/07/12",
"col_2": 24155935,
"col_3": 10932798847,
"col_4": 458,
"col_5": 458,
"col_6": 449.5,
"col_7": 449.5,
"col_8": -12.5,
"col_9": 34431,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 11,
"col_1": "0111/07/13",
"col_2": 48134139,
"col_3": 22639696871,
"col_4": 470.5,
"col_5": 473,
"col_6": 466,
"col_7": 470.5,
"col_8": "+21.00",
"col_9": 48964,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 12,
"col_1": "0111/07/14",
"col_2": 34014188,
"col_3": 16045789881,
"col_4": 466,
"col_5": 477.5,
"col_6": 463,
"col_7": 475,
"col_8": "+4.50",
"col_9": 36454,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 13,
"col_1": "0111/07/15",
"col_2": 56039339,
"col_3": 27285128552,
"col_4": 481,
"col_5": 494,
"col_6": 477,
"col_7": 492.5,
"col_8": "+17.50",
"col_9": 63691,
"111年07月 2330 台積電 各日成交資訊": ""
},
{
"row_number": 14,
"col_1": "0111/07/18",
"col_2": 39878601,
"col_3": 19689642282,
"col_4": 495.5,
"col_5": 498.5,
"col_6": 488.5,
"col_7": 495.5,
"col_8": "+3.00",
"col_9": 42566,
"111年07月 2330 台積電 各日成交資訊": ""
}
]
},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "4d46bd43eacba354d33b52499e1d19e771eb367caa6d2c4586fa6b7ef6bdc87a"
}
}

留言