-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Implement insert and move dimension actions for Google Sheets component #18973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
luancazarine
merged 3 commits into
master
from
18937-action-google-sheets---insert-and-move-rows-at-specific-positions
Nov 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
2976322
Implement insert and move dimension actions for Google Sheets component
luancazarine e876eeb
Update version numbers for multiple Google Sheets actions and sources
luancazarine 3cad6c7
Update components/google_sheets/actions/move-dimension/move-dimension…
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
components/google_sheets/actions/insert-dimension/insert-dimension.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import app from "../../google_sheets.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "google_sheets-insert-dimension", | ||
| name: "Insert Dimension", | ||
| description: "Insert a dimension into a spreadsheet. [See the documentation](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/request#InsertDimensionRequest)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| drive: { | ||
| propDefinition: [ | ||
| app, | ||
| "watchedDrive", | ||
| ], | ||
| }, | ||
| sheetId: { | ||
| propDefinition: [ | ||
| app, | ||
| "sheetID", | ||
| (c) => ({ | ||
| driveId: app.methods.getDriveId(c.drive), | ||
| }), | ||
| ], | ||
| }, | ||
| dimension: { | ||
| type: "string", | ||
| label: "Dimension", | ||
| description: "The dimension to insert", | ||
| options: [ | ||
| { | ||
| label: "Operates on the rows of a sheet", | ||
| value: "ROWS", | ||
| }, | ||
| { | ||
| label: "Operates on the columns of a sheet", | ||
| value: "COLUMNS", | ||
| }, | ||
| ], | ||
| }, | ||
| startIndex: { | ||
| type: "integer", | ||
| label: "Start Index", | ||
| description: "The start (inclusive) of the span, or not set if unbounded", | ||
| optional: true, | ||
| }, | ||
| endIndex: { | ||
| type: "integer", | ||
| label: "End Index", | ||
| description: "The end (exclusive) of the span", | ||
| }, | ||
| inheritFromBefore: { | ||
| type: "boolean", | ||
| label: "Inherit From Before", | ||
| description: `Whether dimension properties should be extended from the dimensions before or after the newly inserted dimensions. True to inherit from the dimensions before (in which case the start index must be greater than 0), and false to inherit from the dimensions after. | ||
| For example, if row index 0 has red background and row index 1 has a green background, then inserting 2 rows at index 1 can inherit either the green or red background. If **inheritFromBefore** is true, the two new rows will be red (because the row before the insertion point was red), whereas if **inheritFromBefore** is false, the two new rows will be green (because the row after the insertion point was green).`, | ||
| default: false, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.insertDimension( this.sheetId, { | ||
| range: { | ||
| dimension: this.dimension, | ||
| startIndex: this.startIndex, | ||
| endIndex: this.endIndex, | ||
| }, | ||
| inheritFromBefore: this.inheritFromBefore, | ||
| }); | ||
| $.export("$summary", "Successfully inserted dimension request"); | ||
| return response; | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
74 changes: 74 additions & 0 deletions
74
components/google_sheets/actions/move-dimension/move-dimension.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import app from "../../google_sheets.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "google_sheets-move-dimension", | ||
| name: "Move Dimension", | ||
| description: "Move a dimension in a spreadsheet. [See the documentation](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/request#MoveDimensionRequest)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| drive: { | ||
| propDefinition: [ | ||
| app, | ||
| "watchedDrive", | ||
| ], | ||
| }, | ||
| sheetId: { | ||
| propDefinition: [ | ||
| app, | ||
| "sheetID", | ||
| (c) => ({ | ||
| driveId: app.methods.getDriveId(c.drive), | ||
| }), | ||
| ], | ||
| }, | ||
| dimension: { | ||
| type: "string", | ||
| label: "Dimension", | ||
| description: "The dimension to insert", | ||
luancazarine marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| options: [ | ||
| { | ||
| label: "Operates on the rows of a sheet", | ||
| value: "ROWS", | ||
| }, | ||
| { | ||
| label: "Operates on the columns of a sheet", | ||
| value: "COLUMNS", | ||
| }, | ||
| ], | ||
| }, | ||
| startIndex: { | ||
| type: "integer", | ||
| label: "Start Index", | ||
| description: "The start (inclusive) of the span", | ||
| }, | ||
| endIndex: { | ||
| type: "integer", | ||
| label: "End Index", | ||
| description: "The end (exclusive) of the span", | ||
| }, | ||
| destinationIndex: { | ||
| type: "integer", | ||
| label: "Destination Index", | ||
| description: "The zero-based start index of where to move the source data to, based on the coordinates *before* the source data is removed from the grid. Existing data will be shifted down or right (depending on the dimension) to make room for the moved dimensions. The source dimensions are removed from the grid, so the the data may end up in a different index than specified. For example, given `A1..A5` of `0, 1, 2, 3, 4` and wanting to move `\"1\"` and `\"2\"` to between `\"3\"` and `\"4\"`, the source would be `ROWS [1..3)`,and the destination index would be `\"4\"` (the zero-based index of row 5). The end result would be `A1..A5` of `0, 3, 1, 2, 4`", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.moveDimension( this.sheetId, { | ||
| source: { | ||
| dimension: this.dimension, | ||
| startIndex: this.startIndex, | ||
| endIndex: this.endIndex, | ||
| }, | ||
| destinationIndex: this.destinationIndex, | ||
| }); | ||
| $.export("$summary", "Successfully moved dimension"); | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return response; | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.