@activepieces/piece-microsoft-excel-365 0.0.19 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.js +43 -17
- package/src/index.js.map +1 -1
- package/src/lib/actions/clear-cells-by-range.d.ts +6 -0
- package/src/lib/actions/clear-cells-by-range.js +68 -0
- package/src/lib/actions/clear-cells-by-range.js.map +1 -0
- package/src/lib/actions/clear-column-by-index.d.ts +6 -0
- package/src/lib/actions/clear-column-by-index.js +74 -0
- package/src/lib/actions/clear-column-by-index.js.map +1 -0
- package/src/lib/actions/clear-row-by-id.d.ts +6 -0
- package/src/lib/actions/clear-row-by-id.js +70 -0
- package/src/lib/actions/clear-row-by-id.js.map +1 -0
- package/src/lib/actions/create-worksheet.d.ts +5 -0
- package/src/lib/actions/create-worksheet.js +81 -0
- package/src/lib/actions/create-worksheet.js.map +1 -0
- package/src/lib/actions/find-row.d.ts +7 -0
- package/src/lib/actions/find-row.js +107 -0
- package/src/lib/actions/find-row.js.map +1 -0
- package/src/lib/actions/get-cells-in-range.d.ts +5 -0
- package/src/lib/actions/get-cells-in-range.js +44 -0
- package/src/lib/actions/get-cells-in-range.js.map +1 -0
- package/src/lib/actions/get-row-by-id.d.ts +6 -0
- package/src/lib/actions/get-row-by-id.js +61 -0
- package/src/lib/actions/get-row-by-id.js.map +1 -0
- package/src/lib/actions/get-worksheet-by-id.d.ts +4 -0
- package/src/lib/actions/get-worksheet-by-id.js +37 -0
- package/src/lib/actions/get-worksheet-by-id.js.map +1 -0
- package/src/lib/actions/rename-worksheet.d.ts +5 -0
- package/src/lib/actions/rename-worksheet.js +51 -0
- package/src/lib/actions/rename-worksheet.js.map +1 -0
- package/src/lib/common/common.d.ts +3 -3
- package/src/lib/common/common.js +55 -71
- package/src/lib/common/common.js.map +1 -1
- package/src/lib/trigger/new-row-in-table.d.ts +17 -0
- package/src/lib/trigger/new-row-in-table.js +139 -0
- package/src/lib/trigger/new-row-in-table.js.map +1 -0
- package/src/lib/trigger/new-worksheet.d.ts +8 -0
- package/src/lib/trigger/new-worksheet.js +94 -0
- package/src/lib/trigger/new-worksheet.js.map +1 -0
- package/src/lib/trigger/updated-row.d.ts +14 -0
- package/src/lib/trigger/updated-row.js +129 -0
- package/src/lib/trigger/updated-row.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-microsoft-excel-365",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.34.11",
|
|
6
6
|
"axios": "1.8.3",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"zod": "3.25.76",
|
|
13
13
|
"@activepieces/pieces-common": "0.7.0",
|
|
14
14
|
"@activepieces/pieces-framework": "0.20.1",
|
|
15
|
-
"@activepieces/shared": "0.
|
|
15
|
+
"@activepieces/shared": "0.22.0",
|
|
16
16
|
"tslib": "2.8.1"
|
|
17
17
|
},
|
|
18
18
|
"overrides": {
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const append_table_rows_1 = require("./lib/actions/append-table-rows");
|
|
|
11
11
|
const clear_worksheet_1 = require("./lib/actions/clear-worksheet");
|
|
12
12
|
const convert_to_range_1 = require("./lib/actions/convert-to-range");
|
|
13
13
|
const create_table_1 = require("./lib/actions/create-table");
|
|
14
|
+
const create_workbook_1 = require("./lib/actions/create-workbook");
|
|
14
15
|
const delete_table_1 = require("./lib/actions/delete-table");
|
|
15
16
|
const delete_workbook_1 = require("./lib/actions/delete-workbook");
|
|
16
17
|
const delete_worksheet_1 = require("./lib/actions/delete-worksheet");
|
|
@@ -21,9 +22,20 @@ const get_worksheet_rows_1 = require("./lib/actions/get-worksheet-rows");
|
|
|
21
22
|
const get_worksheets_1 = require("./lib/actions/get-worksheets");
|
|
22
23
|
const lookup_table_column_1 = require("./lib/actions/lookup-table-column");
|
|
23
24
|
const update_row_1 = require("./lib/actions/update-row");
|
|
24
|
-
const
|
|
25
|
+
const clear_cells_by_range_1 = require("./lib/actions/clear-cells-by-range");
|
|
26
|
+
const clear_column_by_index_1 = require("./lib/actions/clear-column-by-index");
|
|
27
|
+
const clear_row_by_id_1 = require("./lib/actions/clear-row-by-id");
|
|
28
|
+
const create_worksheet_1 = require("./lib/actions/create-worksheet");
|
|
29
|
+
const find_row_1 = require("./lib/actions/find-row");
|
|
30
|
+
const get_cells_in_range_1 = require("./lib/actions/get-cells-in-range");
|
|
31
|
+
const get_row_by_id_1 = require("./lib/actions/get-row-by-id");
|
|
32
|
+
const get_worksheet_by_id_1 = require("./lib/actions/get-worksheet-by-id");
|
|
33
|
+
const rename_worksheet_1 = require("./lib/actions/rename-worksheet");
|
|
25
34
|
const new_row_added_1 = require("./lib/trigger/new-row-added");
|
|
26
|
-
const
|
|
35
|
+
const new_row_in_table_1 = require("./lib/trigger/new-row-in-table");
|
|
36
|
+
const new_worksheet_1 = require("./lib/trigger/new-worksheet");
|
|
37
|
+
const updated_row_1 = require("./lib/trigger/updated-row");
|
|
38
|
+
const common_1 = require("./lib/common/common");
|
|
27
39
|
const authDesc = `
|
|
28
40
|
1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/).
|
|
29
41
|
2. From the left sidebar, go to **Microsoft Enfra ID**.
|
|
@@ -31,21 +43,21 @@ const authDesc = `
|
|
|
31
43
|
4. Click the **New registration** button.
|
|
32
44
|
5. Enter a **Name** for your app.
|
|
33
45
|
6. For **Supported account types**, choose:
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
- **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts**
|
|
47
|
+
- Or select based on your requirement.
|
|
36
48
|
7. In **Redirect URI**, select **Web** and add the given URL.
|
|
37
49
|
8. Click **Register**.
|
|
38
50
|
9. After registration, you’ll be redirected to the app’s overview page. Copy the **Application (client) ID**.
|
|
39
51
|
10. From the left menu, go to **Certificates & secrets**.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
- Under **Client secrets**, click **New client secret**.
|
|
53
|
+
- Provide a description, set an expiry, and click **Add**.
|
|
54
|
+
- Copy the **Value** of the client secret (this will not be shown again).
|
|
43
55
|
11. Go to **API permissions** from the left menu.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
- Click **Add a permission**.
|
|
57
|
+
- Select **Microsoft Graph** → **Delegated permissions**.
|
|
58
|
+
- Add the following scopes:
|
|
59
|
+
- Files.ReadWrite
|
|
60
|
+
- offline_access
|
|
49
61
|
- Click **Add permissions**.
|
|
50
62
|
12. Copy your **Client ID** and **Client Secret**.
|
|
51
63
|
`;
|
|
@@ -64,7 +76,7 @@ exports.microsoftExcel = (0, pieces_framework_1.createPiece)({
|
|
|
64
76
|
minimumSupportedRelease: '0.30.0',
|
|
65
77
|
logoUrl: 'https://cdn.activepieces.com/pieces/microsoft-excel-365.png',
|
|
66
78
|
categories: [shared_1.PieceCategory.PRODUCTIVITY],
|
|
67
|
-
authors: [
|
|
79
|
+
authors: ['BastienMe', 'kishanprmr', 'MoShizzle', 'abuaboud', 'Pranith124', 'onyedikachi-david'],
|
|
68
80
|
actions: [
|
|
69
81
|
append_row_1.appendRowAction,
|
|
70
82
|
get_worksheets_1.getWorksheetsAction,
|
|
@@ -83,16 +95,30 @@ exports.microsoftExcel = (0, pieces_framework_1.createPiece)({
|
|
|
83
95
|
append_table_rows_1.appendTableRowsAction,
|
|
84
96
|
convert_to_range_1.convertToRangeAction,
|
|
85
97
|
create_workbook_1.createWorkbook,
|
|
98
|
+
clear_column_by_index_1.clearColumnAction,
|
|
99
|
+
clear_cells_by_range_1.clearRangeAction,
|
|
100
|
+
clear_row_by_id_1.clearRowAction,
|
|
101
|
+
create_worksheet_1.createWorksheetAction,
|
|
102
|
+
find_row_1.findRowAction,
|
|
103
|
+
get_cells_in_range_1.getRangeAction,
|
|
104
|
+
get_row_by_id_1.getRowAction,
|
|
105
|
+
get_worksheet_by_id_1.getWorksheetAction,
|
|
106
|
+
rename_worksheet_1.renameWorksheetAction,
|
|
86
107
|
(0, pieces_common_1.createCustomApiCallAction)({
|
|
87
108
|
baseUrl: () => common_1.excelCommon.baseUrl,
|
|
88
109
|
auth: exports.excelAuth,
|
|
89
110
|
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
90
111
|
return ({
|
|
91
|
-
Authorization: `Bearer ${auth.access_token}
|
|
112
|
+
Authorization: `Bearer ${auth.access_token}`
|
|
92
113
|
});
|
|
93
|
-
})
|
|
94
|
-
})
|
|
114
|
+
})
|
|
115
|
+
})
|
|
95
116
|
],
|
|
96
|
-
triggers: [
|
|
117
|
+
triggers: [
|
|
118
|
+
new_row_added_1.readNewRows,
|
|
119
|
+
new_row_in_table_1.newRowInTableTrigger,
|
|
120
|
+
new_worksheet_1.newWorksheetTrigger,
|
|
121
|
+
updated_row_1.updatedRowTrigger
|
|
122
|
+
]
|
|
97
123
|
});
|
|
98
124
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/microsoft-excel-365/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAIwC;AACxC,iDAAqD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/microsoft-excel-365/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAIwC;AACxC,iDAAqD;AAErD,+DAAiE;AACjE,yDAA2D;AAC3D,uEAAwE;AACxE,mEAAqE;AACrE,qEAAsE;AACtE,6DAA+D;AAC/D,mEAA+D;AAC/D,6DAA+D;AAC/D,mEAAqE;AACrE,qEAAuE;AACvE,uEAAwE;AACxE,iEAAkE;AAClE,+DAAiE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a;QACb,mCAAc;QACd,4BAAY;QACZ,wCAAkB;QAClB,wCAAqB;QACrB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAW,CAAC,OAAO;YAClC,IAAI,EAAE,iBAAS;YACf,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACtE,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE;QACR,2BAAW;QACX,uCAAoB;QACpB,mCAAmB;QACnB,+BAAiB;KAClB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const clearRangeAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
workbook_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
worksheet_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
range: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
applyTo: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearRangeAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common/common");
|
|
9
|
+
exports.clearRangeAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.excelAuth,
|
|
11
|
+
name: 'clear_range',
|
|
12
|
+
displayName: 'Clear Cells by Range',
|
|
13
|
+
description: 'Clear a block of cells (range) content or formatting.',
|
|
14
|
+
props: {
|
|
15
|
+
workbook_id: common_1.excelCommon.workbook_id,
|
|
16
|
+
worksheet_id: common_1.excelCommon.worksheet_id,
|
|
17
|
+
range: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Range',
|
|
19
|
+
description: 'The range of cells to clear, in A1 notation (e.g., "A1:C5").',
|
|
20
|
+
required: true
|
|
21
|
+
}),
|
|
22
|
+
applyTo: pieces_framework_1.Property.StaticDropdown({
|
|
23
|
+
displayName: 'Clear Type',
|
|
24
|
+
description: 'Specify what to clear from the range.',
|
|
25
|
+
required: true,
|
|
26
|
+
defaultValue: 'All',
|
|
27
|
+
options: {
|
|
28
|
+
options: [
|
|
29
|
+
{
|
|
30
|
+
label: 'All (Contents and Formatting)',
|
|
31
|
+
value: 'All'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'Contents Only',
|
|
35
|
+
value: 'Contents'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: 'Formats Only',
|
|
39
|
+
value: 'Formats'
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
},
|
|
45
|
+
run(context) {
|
|
46
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const { workbook_id, worksheet_id, range, applyTo } = context.propsValue;
|
|
48
|
+
const { access_token } = context.auth;
|
|
49
|
+
if (!/^[A-Z]+[1-9][0-9]*(:[A-Z]+[1-9][0-9]*)?$/.test(range)) {
|
|
50
|
+
throw new Error('Invalid range format. Please use A1 notation (e.g., "A1" or "A1:C5").');
|
|
51
|
+
}
|
|
52
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
53
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
54
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/${worksheet_id}/range(address='${range}')/clear`,
|
|
55
|
+
authentication: {
|
|
56
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
57
|
+
token: access_token
|
|
58
|
+
},
|
|
59
|
+
body: {
|
|
60
|
+
applyTo: applyTo
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
// A successful request returns a 200 OK with no body.
|
|
64
|
+
return response.body;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=clear-cells-by-range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-cells-by-range.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/clear-cells-by-range.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,uCAAwC;AACxC,6CAA+C;AAElC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE;QACL,WAAW,EAAE,oBAAW,CAAC,WAAW;QACpC,YAAY,EAAE,oBAAW,CAAC,YAAY;QACtC,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EACT,8DAA8D;YAChE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC/B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,+BAA+B;wBACtC,KAAK,EAAE,KAAK;qBACb;oBACD;wBACE,KAAK,EAAE,eAAe;wBACtB,KAAK,EAAE,UAAU;qBAClB;oBACD;wBACE,KAAK,EAAE,cAAc;wBACrB,KAAK,EAAE,SAAS;qBACjB;iBACF;aACF;SACF,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAEtC,IAAI,CAAC,0CAA0C,CAAC,IAAI,CAAC,KAAe,CAAC,EAAE,CAAC;gBACpE,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;YAC7F,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,oBAAW,CAAC,OAAO,UAAU,WAAW,wBAAwB,YAAY,mBAAmB,KAAK,UAAU;gBACtH,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,YAAY;iBACpB;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,OAAO;iBACjB;aACF,CAAC,CAAC;YAEH,sDAAsD;YACtD,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const clearColumnAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
workbook_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
worksheet_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
column_index: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
5
|
+
applyTo: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearColumnAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common/common");
|
|
9
|
+
exports.clearColumnAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.excelAuth,
|
|
11
|
+
name: 'clear_column',
|
|
12
|
+
displayName: 'Clear Column by Index',
|
|
13
|
+
description: 'Clear contents/formatting of a column by its index.',
|
|
14
|
+
props: {
|
|
15
|
+
workbook_id: common_1.excelCommon.workbook_id,
|
|
16
|
+
worksheet_id: common_1.excelCommon.worksheet_id,
|
|
17
|
+
column_index: pieces_framework_1.Property.Number({
|
|
18
|
+
displayName: 'Column Index',
|
|
19
|
+
description: 'The 1-based index of the column to be cleared (e.g., 1 for column A, 2 for column B).',
|
|
20
|
+
required: true
|
|
21
|
+
}),
|
|
22
|
+
applyTo: pieces_framework_1.Property.StaticDropdown({
|
|
23
|
+
displayName: 'Clear Type',
|
|
24
|
+
description: 'Specify what to clear from the column.',
|
|
25
|
+
required: true,
|
|
26
|
+
defaultValue: 'All',
|
|
27
|
+
options: {
|
|
28
|
+
options: [
|
|
29
|
+
{
|
|
30
|
+
label: 'All (Contents and Formatting)',
|
|
31
|
+
value: 'All'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'Contents Only',
|
|
35
|
+
value: 'Contents'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: 'Formats Only',
|
|
39
|
+
value: 'Formats'
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
},
|
|
45
|
+
run(context) {
|
|
46
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const { workbook_id, worksheet_id, column_index, applyTo } = context.propsValue;
|
|
48
|
+
const { access_token } = context.auth;
|
|
49
|
+
if (typeof column_index !== 'number' ||
|
|
50
|
+
!Number.isInteger(column_index) ||
|
|
51
|
+
column_index < 1) {
|
|
52
|
+
throw new Error('Column index must be a positive integer.');
|
|
53
|
+
}
|
|
54
|
+
// Convert 1-based index to Excel column letter (e.g., 1 -> 'A')
|
|
55
|
+
const columnLetter = common_1.excelCommon.numberToColumnName(column_index);
|
|
56
|
+
// Construct the range address for the entire column, e.g., 'C:C'
|
|
57
|
+
const columnAddress = `${columnLetter}:${columnLetter}`;
|
|
58
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
59
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
60
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/${worksheet_id}/range(address='${columnAddress}')/clear`,
|
|
61
|
+
authentication: {
|
|
62
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
63
|
+
token: access_token
|
|
64
|
+
},
|
|
65
|
+
body: {
|
|
66
|
+
applyTo: applyTo
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
// A successful request returns a 200 OK with no body.
|
|
70
|
+
return response.body;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=clear-column-by-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-column-by-index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/clear-column-by-index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,uCAAwC;AACxC,6CAA+C;AAElC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,qDAAqD;IAClE,KAAK,EAAE;QACL,WAAW,EAAE,oBAAW,CAAC,WAAW;QACpC,YAAY,EAAE,oBAAW,CAAC,YAA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AAa,UAAU;gBAC9H,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,YAAY;iBACpB;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,OAAO;iBACjB;aACF,CAAC,CAAC;YAEH,sDAAsD;YACtD,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const clearRowAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
workbook_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
worksheet_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
row_id: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
5
|
+
applyTo: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearRowAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common/common");
|
|
9
|
+
exports.clearRowAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.excelAuth,
|
|
11
|
+
name: 'clear_row',
|
|
12
|
+
displayName: 'Clear Row by ID',
|
|
13
|
+
description: 'Clear contents/formatting of an entire row by its ID.',
|
|
14
|
+
props: {
|
|
15
|
+
workbook_id: common_1.excelCommon.workbook_id,
|
|
16
|
+
worksheet_id: common_1.excelCommon.worksheet_id,
|
|
17
|
+
row_id: pieces_framework_1.Property.Number({
|
|
18
|
+
displayName: 'Row Number',
|
|
19
|
+
description: 'The number of the row to be cleared (e.g., 5 for the 5th row).',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
applyTo: pieces_framework_1.Property.StaticDropdown({
|
|
23
|
+
displayName: "Clear Type",
|
|
24
|
+
description: "Specify what to clear from the row.",
|
|
25
|
+
required: true,
|
|
26
|
+
defaultValue: 'All',
|
|
27
|
+
options: {
|
|
28
|
+
options: [
|
|
29
|
+
{
|
|
30
|
+
label: 'All (Contents and Formatting)',
|
|
31
|
+
value: 'All'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'Contents Only',
|
|
35
|
+
value: 'Contents'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: 'Formats Only',
|
|
39
|
+
value: 'Formats'
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
},
|
|
45
|
+
run(context) {
|
|
46
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const { workbook_id, worksheet_id, row_id, applyTo } = context.propsValue;
|
|
48
|
+
const { access_token } = context.auth;
|
|
49
|
+
if (typeof row_id !== 'number' || !Number.isInteger(row_id) || row_id < 1) {
|
|
50
|
+
throw new Error('Row index must be a positive integer.');
|
|
51
|
+
}
|
|
52
|
+
// Construct the range address for the entire row, e.g., '5:5'
|
|
53
|
+
const rowAddress = `${row_id}:${row_id}`;
|
|
54
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
55
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
56
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/${worksheet_id}/range(address='${rowAddress}')/clear`,
|
|
57
|
+
authentication: {
|
|
58
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
59
|
+
token: access_token,
|
|
60
|
+
},
|
|
61
|
+
body: {
|
|
62
|
+
applyTo: applyTo,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
// A successful request returns a 200 OK with no body.
|
|
66
|
+
return response.body;
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=clear-row-by-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-row-by-id.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/clear-row-by-id.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyF;AACzF,uCAAwC;AACxC,6CAA+C;AAElC,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE;QACH,WAAW,EAAE,oBAAW,CAAC,WAAW;QACpC,YAAY,EAAE,oBAAW,CAAC,YAAY;QACtC,MAAM,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL;wBACI,KAAK,EAAE,+BAA+B;wBACtC,KAAK,EAAE,KAAK;qBACf;oBACD;wBACI,KAAK,EAAE,eAAe;wBACtB,KAAK,EAAE,UAAU;qBACpB;oBACD;wBACI,KAAK,EAAE,cAAc;wBACrB,KAAK,EAAE,SAAS;qBACnB;iBACJ;aACJ;SACJ,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC1E,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAEtC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;YAC7D,CAAC;YAGD,8DAA8D;YAC9D,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;YAEzC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,oBAAW,CAAC,OAAO,UAAU,WAAW,wBAAwB,YAAY,mBAAmB,UAAU,UAAU;gBAC3H,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,YAAY;iBACtB;gBACD,IAAI,EAAE;oBACF,OAAO,EAAE,OAAO;iBACnB;aACJ,CAAC,CAAC;YAEH,sDAAsD;YACtD,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const createWorksheetAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
workbook_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
headers: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWorksheetAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const index_1 = require("../../index");
|
|
7
|
+
const common_1 = require("../common/common");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
exports.createWorksheetAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.excelAuth,
|
|
11
|
+
name: 'create_worksheet',
|
|
12
|
+
displayName: 'Create Worksheet',
|
|
13
|
+
description: 'Add a new worksheet (tab) to an existing workbook with optional default headers.',
|
|
14
|
+
props: {
|
|
15
|
+
workbook_id: common_1.excelCommon.workbook_id,
|
|
16
|
+
name: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Worksheet Name',
|
|
18
|
+
description: "The name for the new worksheet. If not provided, a default name like 'Sheet1' will be assigned.",
|
|
19
|
+
required: false
|
|
20
|
+
}),
|
|
21
|
+
headers: pieces_framework_1.Property.Array({
|
|
22
|
+
displayName: 'Headers',
|
|
23
|
+
description: 'Optional: A list of headers to add to the first row. A table will be created from these headers.',
|
|
24
|
+
required: false
|
|
25
|
+
})
|
|
26
|
+
},
|
|
27
|
+
run(context) {
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const { workbook_id, name, headers } = context.propsValue;
|
|
30
|
+
const { access_token } = context.auth;
|
|
31
|
+
// Step 1: Create the new worksheet
|
|
32
|
+
const createWorksheetResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
33
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
34
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/add`,
|
|
35
|
+
authentication: {
|
|
36
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
37
|
+
token: access_token
|
|
38
|
+
},
|
|
39
|
+
body: Object.assign({}, (name ? { name } : {}))
|
|
40
|
+
});
|
|
41
|
+
const newWorksheetName = createWorksheetResponse.body.name;
|
|
42
|
+
// Step 2: If headers are provided, add them and create a table from them
|
|
43
|
+
if (headers && Array.isArray(headers) && headers.length > 0) {
|
|
44
|
+
const headersArray = headers;
|
|
45
|
+
// Calculate the table range, e.g., "A1:C1" for 3 headers
|
|
46
|
+
const endColumn = common_1.excelCommon.numberToColumnName(headersArray.length);
|
|
47
|
+
const address = `A1:${endColumn}1`;
|
|
48
|
+
// Add the header values to the first row of the new worksheet
|
|
49
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
50
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
51
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/${newWorksheetName}/range(address='${address}')`,
|
|
52
|
+
authentication: {
|
|
53
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
54
|
+
token: access_token
|
|
55
|
+
},
|
|
56
|
+
body: {
|
|
57
|
+
values: [headersArray] // Values must be a 2D array
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
// Create a table from the newly added header range
|
|
61
|
+
const createTableResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
62
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
63
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/${newWorksheetName}/tables/add`,
|
|
64
|
+
authentication: {
|
|
65
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
66
|
+
token: access_token
|
|
67
|
+
},
|
|
68
|
+
body: {
|
|
69
|
+
address: address,
|
|
70
|
+
hasHeaders: true
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// Return the result of the table creation
|
|
74
|
+
return createTableResponse.body;
|
|
75
|
+
}
|
|
76
|
+
// If no headers were provided, return the result of the worksheet creation
|
|
77
|
+
return createWorksheetResponse.body;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=create-worksheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-worksheet.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/create-worksheet.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,uCAAwC;AACxC,6CAA+C;AAC/C,+DAIqC;AAUxB,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,kFAAkF;IACpF,KAAK,EAAE;QACL,WAAW,EAAE,oBAAW,CAAC,WAAW;QACpC,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EACT,iGAAiG;YACnG,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACtB,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,kGAAkG;YACpG,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC1D,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAEtC,mCAAmC;YACnC,MAAM,uBAAuB,GAC3B,MAAM,0BAAU,CAAC,WAAW,CAA0B;gBACpD,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,oBAAW,CAAC,OAAO,UAAU,WAAW,0BAA0B;gBAC1E,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,YAAY;iBACpB;gBACD,IAAI,oBAEC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC1B;aACF,CAAC,CAAC;YAEL,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,IA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AAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const findRowAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
workbook_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
worksheet_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
table_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
5
|
+
lookup_column: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
6
|
+
lookup_value: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findRowAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
const common_1 = require("../common/common");
|
|
9
|
+
exports.findRowAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.excelAuth,
|
|
11
|
+
name: 'find_row',
|
|
12
|
+
displayName: 'Find Row',
|
|
13
|
+
description: 'Locate a row by specifying a lookup column and value (e.g. find a row where “ID” = 123).',
|
|
14
|
+
props: {
|
|
15
|
+
workbook_id: common_1.excelCommon.workbook_id,
|
|
16
|
+
worksheet_id: common_1.excelCommon.worksheet_id,
|
|
17
|
+
table_id: common_1.excelCommon.table_id,
|
|
18
|
+
lookup_column: pieces_framework_1.Property.Dropdown({
|
|
19
|
+
displayName: 'Lookup Column',
|
|
20
|
+
description: 'The column to search in.',
|
|
21
|
+
required: true,
|
|
22
|
+
refreshers: ['workbook_id', 'table_id'],
|
|
23
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, workbook_id, table_id }) {
|
|
24
|
+
if (!auth || !workbook_id || !table_id) {
|
|
25
|
+
return {
|
|
26
|
+
disabled: true,
|
|
27
|
+
options: [],
|
|
28
|
+
placeholder: 'Please select a workbook and table first.'
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const authProp = auth;
|
|
32
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
33
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
34
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/tables/${table_id}/columns`,
|
|
35
|
+
authentication: {
|
|
36
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
37
|
+
token: authProp.access_token
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
disabled: false,
|
|
42
|
+
options: response.body.value.map((column) => ({
|
|
43
|
+
label: column.name,
|
|
44
|
+
value: column.id
|
|
45
|
+
}))
|
|
46
|
+
};
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
49
|
+
lookup_value: pieces_framework_1.Property.ShortText({
|
|
50
|
+
displayName: 'Lookup Value',
|
|
51
|
+
description: 'The value to find in the lookup column.',
|
|
52
|
+
required: true
|
|
53
|
+
})
|
|
54
|
+
},
|
|
55
|
+
run(context) {
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const { workbook_id, table_id, lookup_column, lookup_value } = context.propsValue;
|
|
58
|
+
const { access_token } = context.auth;
|
|
59
|
+
const columnId = lookup_column;
|
|
60
|
+
const sanitizedValue = lookup_value.replace(/'/g, "''");
|
|
61
|
+
// Define the URL to clear the filter, which will be used in the 'finally' block
|
|
62
|
+
const clearFilterUrl = `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/tables/${table_id}/columns/${columnId}/filter/clear`;
|
|
63
|
+
try {
|
|
64
|
+
// Step 1: Apply the filter to the specified column
|
|
65
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
66
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
67
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/tables/${table_id}/columns/${columnId}/filter/apply`,
|
|
68
|
+
authentication: {
|
|
69
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
70
|
+
token: access_token
|
|
71
|
+
},
|
|
72
|
+
body: {
|
|
73
|
+
criteria: {
|
|
74
|
+
criterion1: `=${sanitizedValue}`,
|
|
75
|
+
filterOn: 'Custom'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
// Step 2: Get the visible rows (i.e., the filtered results)
|
|
80
|
+
const foundRowsResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
81
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
82
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/tables/${table_id}/range/visibleView/rows`,
|
|
83
|
+
authentication: {
|
|
84
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
85
|
+
token: access_token
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
// The result is the array of rows that matched the filter
|
|
89
|
+
return foundRowsResponse.body.value;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
// Step 3: Clear the filter to restore the table to its original state.
|
|
93
|
+
// This runs regardless of whether the previous steps succeeded or failed.
|
|
94
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
95
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
96
|
+
url: clearFilterUrl,
|
|
97
|
+
authentication: {
|
|
98
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
99
|
+
token: access_token
|
|
100
|
+
},
|
|
101
|
+
body: {} // Clear action does not require a body
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=find-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-row.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/find-row.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAIqC;AACrC,uCAAwC;AACxC,6CAA+C;AAElC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,UAAU;IACvB,WAAW,EACT,0FAA0F;IAC5F,KAAK,EAAE;QACL,WAAW,EAAE,oBAAW,CAAC,WAAW;QACpC,YAAY,EAAE,oBAAW,CAAC,YAAY;QACtC,QAAQ,EAAE,oBAAW,CAAC,QAAQ;QAC9B,aAAa,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC;YACvC,OAAO,EAAE,KAAwC,EAAE,oDAAnC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE;gBAC7C,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACvC,OAAO;wBACL,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,2CAA2C;qBACzD,CAAC;gBACJ,CAAC;gBACD,MAAM,QAAQ,GAAG,IAA2B,CAAC;gBAC7C,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAE1C;oBACD,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,GAAG,EAAE,GAAG,oBAAW,CAAC,OAAO,UAAU,WAAW,oBAAoB,QAAQ,UAAU;oBACtF,cAAc,EAAE;wBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;wBACrC,KAAK,EAAE,QAAQ,CAAC,YAAY;qBAC7B;iBACF,CAAC,CAAC;gBA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;qBACF;iBACF,CAAC,CAAC;gBAEH,4DAA4D;gBAC5D,MAAM,iBAAiB,GAAG,MAAM,0BAAU,CAAC,WAAW,CAEnD;oBACD,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,GAAG,EAAE,GAAG,oBAAW,CAAC,OAAO,UAAU,WAAW,oBAAoB,QAAQ,yBAAyB;oBACrG,cAAc,EAAE;wBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;wBACrC,KAAK,EAAE,YAAY;qBACpB;iBACF,CAAC,CAAC;gBAEH,0DAA0D;gBAC1D,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;YACtC,CAAC;oBAAS,CAAC;gBACT,uEAAuE;gBACvE,0EAA0E;gBAC1E,MAAM,0BAAU,CAAC,WAAW,CAAC;oBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;oBACvB,GAAG,EAAE,cAAc;oBACnB,cAAc,EAAE;wBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;wBACrC,KAAK,EAAE,YAAY;qBACpB;oBACD,IAAI,EAAE,EAAE,CAAC,uCAAuC;iBACjD,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const getRangeAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
workbook_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
worksheet_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
range: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|