開発ツール
アントニー・ショー
マーケティングの専門家
2022年12月29日
注:プロジェクトのLatenode チェーンに新しいノードを追加した後、前のノードのデータにアクセスするには、プロジェクトを実行し、必要なすべてのデータを含むチェーンを呼び出す必要があります。JavaScript "ノードから "HTTPリクエスト "ノードに代入されるデータは、しばしば二重引用符でエスケープする必要があります。リモートサーバーからのリクエストに応答して受信した複雑なオブジェクトや配列は、文字列として送られてくるため、"JavaScript "ノードで対応するデータ型と同じように扱うには、JSON.parseで処理する必要があります。
First, let's make sure to get the token according to the instructions in our article, only in the list choose "Google Sheets API v..." scope "www.googleapis.com/auth/spreadsheets" and "www.googleapis.com/auth/drive";
Create a new table, you can for example call it "LatenodeTestSheet4Add", with two columns "ID" and "Name";
冒頭のステップで得たトークンを代入してみよう;
Webhook」ノードを作成します:「ノードの追加" => "Http" => "Webhook";
Webhookのアドレスをコピーし、残りのクライアントのアドレスバーに貼り付けます;
Next, add another "JavaScript" node: "+ Add Node" => "Code" => "JavaScript";
セーブする;
ノードを結びつける;
ノード間でデータを転送するために、チェーンを開始し、呼び出そう;
その中に内容をコピーしてみよう:
Let's check in all constructions like "data["{{1.body.name}}"]" that the number of Webhook corresponds to the one we are getting data from, if not replace it with the necessary one (let me remind you that 1 is the node number written just below the node name above the node type, then if it is a query then the object field responsible for the type of sent/received data is selected - body for forms or query for query parameters);
変更を保存する;
Create the "HTTP request" node to get the id of the table file: "+ Add node" => "Http" => "HTTP request";
セーブする;
ノードを結びつける;
ノード間でデータを転送するために、チェーンを開始し、呼び出そう;
Let's form the "Url" field: at the beginning let's substitute the variable "apiDriveURI" from "JavaScript", after it we specify ?:q=name "variable tableFileName from "JavaScript"";
デフォルトのメソッドが "Get "であることを確認してください;
Let's add the "Autorization" header and the "bToken" variable from "JavaScript" to its value;
保存」をクリックする;
Create the "HTTP request" node to add data: "+ Add node" => "Http" => "HTTP request";
セーブする;
ノードを結びつける;
ノード間でデータを転送するために、チェーンを開始し、呼び出そう;
Let's form the "Url" field: at the beginning let's substitute the variable "apiSheetURI" from "JavaScript", after it /spreadsheets/, after that substitute the value we got in the previous node {{ 3.body.files[ 0 ].id}}, and at the end /values/A:B:append?valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS&includeValuesInResponse=true;
メソッドを "Post "メソッドに変更する;
In the body of "raw" let's substitute:
Let's add the "Autorization" header and the "bToken" variable from the first "JavaScript" node to its value;
Let's also add a "Content-Type" header with the value "application/json";
保存」をクリックする;
ノード間でデータを転送するために、チェーンを開始し、呼び出そう;
Check our table, there should be a new entry;
Latenode 、チェーン全体の最後には次のようになる:
See you in new articles
Latenode
Google OAuth 2.0 プレイグラウンド