개발 도구
안토니 쇼
마케팅 전문가
2022년 12월 29일
노코드 단순성과 풀코드 파워를 결합한 로우코드 플랫폼 🚀
무료로 시작하기
2022년 12월 29일
-
10m
최소 읽기

다음을 사용하여 테이블에 새 행 만들기 Latenode

안토니 쇼
마케팅 전문가
목차

참고: 프로젝트의 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";

REQ01: 휴식 클라이언트 요청


  curl --request POST  --url 'https://webhook.latenode.com/69/dev/becaa2c2-fcf6-4ef8-89a9-f375b3c0ba26?='
  --header 'Content-Type: application/x-www-form-urlencoded'
  --data 'token=[Replace the square brackets with the content of your token]'
  --data 'tableName=LatenodeTestSheet4Add'
  --data 'id=3'
  --data 'name=Latenode'

앞의 단계에서 얻은 토큰으로 대체해 보겠습니다;

"웹훅" 노드를 만듭니다: "+ 노드 추가" => "Http" => "웹훅";

웹훅 주소를 복사하여 나머지 클라이언트 주소창에 붙여넣습니다;

Next, add another "JavaScript" node: "+ Add Node" => "Code" => "JavaScript";

저장;

노드를 서로 연결합니다;

체인을 시작하고 호출하여 노드 간에 데이터를 전송해 보겠습니다;

내용을 복사해 보겠습니다:


const apiDriveURI = "https://www.googleapis.com/drive/v3/files";
const apiSheetURI= "https://sheets.googleapis.com/v4";
const bToken = "Bearer " + data["{{1.body.token}}"];
const tableFileName = data["{{1.body.tableName}}"];
const newID = data["{{1.body.id}}"];
const newName = data["{{1.body.name}}"];

return {
	apiDriveURI,
	apiSheetURI,
	bToken,
	tableFileName,
	newID,
	newName
}

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"";

기본 메서드가 "가져오기"인지 확인합니다;

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;

방법을 '게시' 방법으로 변경합니다;

In the body of "raw" let's substitute:


{
	"range": "A:B",
	"majorDimension": "ROWS",
	"values": [[{{2.newID}}, "{{2.newName}}"]]
}

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

유용한 링크:

Basic:

Latenode
Google OAuth 2.0 플레이그라운드

정보:

Google Drive API
Google Drive Files: list
Google Sheet API

Google Sheet Method: spreadsheets.values.append

관련 블로그

사용 사례

지원 대상