Create Googlesheets
One of our Actions, create.spreadsheet.row
be able to create a new row in a Google Spreadsheet.
To proceed with this scenario, you need to follow these steps:
- Obtain the OAuth URL and complete the OAuth process.
- Create the spreadsheet using the Action
create.spreadsheet.row
1. Google Spreadsheet OAuth
Please complete the 1. Obtain OAuth URL
step.
By following the instructions below, you will receive the OAuth URL.
[Request]
curl --location 'http://localhost:1290/v1/connector/googlesheets/oauth?userId={{yourUserId}}' \
--header 'api_key: default'
[Response]
https://accounts.google.com/o/oauth2/v2/auth?prompt=consent&access_type=offline&include_granted_scopes=true&response_type=code&redirect_uri=https%3A%2F%2Fproxy.interactor.com%3A4443%2Fplatform%2FUNLICENSED%2Foauth&state=XCP.jp_lM3LyKyQK8EabFJYThEvVCTPNZ4j9CWRkjfGnk6ha0GEJyluMXXulJLsl0y71v_lPRK9peDN_PIEcq6dodL70tjOQ67wiRTVfLIos6HSiiC8&client_id=859731562219-6vjoh4d3ovfpihfs0hrti7s5f651c1l7.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fspreadsheets
2. Create the spreadsheet using the Action create.spreadsheet.row
Execute the step 2. Create the spreadsheet using the Action
to create a new Google Spreadsheet.
2-1 Example - Create new Google Spreadsheet
When creating a new Google Spreadsheet, you need to provide the following request.
[Request]
curl --location 'http://localhost:1290/v1/connector/googlesheets/action/create.spreadsheet/execute?userId={{yourUserId}}' \
--header 'api_key: default' \
--header 'Content-Type: application/json' \
--data '{
"title": "newSpreadSheet" // The title of the new spreadsheet (required)
}'
[Response]
{
"input": {
"title": "newSpreadSheet"
},
"output": {
"data": {
"properties": {
"autoRecalc": "ON_CHANGE",
"defaultFormat": {
"backgroundColor": {
"blue": 1,
"green": 1,
"red": 1
},
...
},
"locale": "en_US",
"spreadsheetTheme": {
"primaryFontFamily": "Arial",
"themeColors": [
{
"color": {
"rgbColor": {}
},
"colorType": "TEXT"
},
....
]
},
"timeZone": "Etc/GMT",
"title": "newSpreadSheet"
},
"sheets": [
{
"properties": {
"gridProperties": {
"columnCount": 26,
"rowCount": 1000
},
"index": 0,
"sheetId": 0,
"sheetType": "GRID",
"title": "Sheet1"
}
}
],
"spreadsheetId": "16TNDssVMasdVvcs71IFtCymVI",
"spreadsheetUrl": "https://docs.google.com/spreadsheets/d/16TNDVMOjLEC2tc1iFeBq5asdymVI/edit?ouid=11677296asdasd67877544"
}
}
}
2-2 Example - Create new Google Spreadsheet with copyed worksheet (Optional)
When creating a new Google Spreadsheet with a copied worksheet, you need to provide the following request.
Get sheetId to copy
When you want to copy a worksheet, you need to get the sheetId
of the worksheet you want to copy.
[Request]
curl --location 'http://localhost:1290/v1/connector/googlesheets/datatype/GoogleSpreadsheet/execute?userId={{yourUserId}}' \
--header 'api_key: default' \
--header 'Content-Type: application/json' \
--data '{
}'
[Response]
The values are retrieved from My Drive.
{
"input": {},
"output": {
"data": [
{
"label": "Test Sheet",
"value": {
"id": "1oFClVS4x12312zcTDL5IeJrg9GaasdqavY", // {{SheetId}}
"name": "Test Sheet"
}
},
...
]
}
}
Create new Google Spreadsheet with copied worksheet
When creating a new Google Spreadsheet with a copied worksheet, you need to provide the following request.
[Request]
curl --location 'http://localhost:1290/v1/connector/googlesheets/action/create.spreadsheet/execute?userId={{yourUserId}}' \
--header 'api_key: default' \
--header 'Content-Type: application/json' \
--data '{
"title": "newSpreadSheet",
"spreadsheetToCopy" : {
"id": "{{SheetId}}" <--- The sheetId of the spreadsheet you want to copy
}
}'
[Response]
{
"input": {
"title": "newSpreadSheet",
"spreadsheetToCopy": {
"id": "{{SheetId}}"
}
},
"output": {
"data": {
"properties": {
"autoRecalc": "ON_CHANGE",
"defaultFormat": {
"backgroundColor": {
"blue": 1,
"green": 1,
"red": 1
},
...
},
"locale": "en_US",
"spreadsheetTheme": {
"primaryFontFamily": "Arial",
"themeColors": [
{
"color": {
"rgbColor": {}
},
"colorType": "TEXT"
},
....
]
},
"timeZone": "Etc/GMT",
"title": "newSpreadSheet"
},
"sheets": [
{
"properties": {
"gridProperties": {
"columnCount": 26,
"rowCount": 1000
},
"index": 0,
"sheetId": 0,
"sheetType": "GRID",
"title": "Sheet1"
}
}
],
"spreadsheetId": "16TNDssVMasdVvcs71IFtCymVI",
"spreadsheetUrl": "https://docs.google.com/spreadsheets/d/16TNDVMOjLEC2tc1iFeBq5asdymVI/edit?ouid=11677296asdasd67877544"
}
}
}