@activepieces/piece-microsoft-excel-365 0.0.18 → 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 +3 -4
- package/src/i18n/de.json +0 -1
- package/src/i18n/es.json +0 -1
- package/src/i18n/fr.json +0 -1
- package/src/i18n/ja.json +0 -1
- package/src/i18n/nl.json +0 -1
- package/src/i18n/pt.json +0 -1
- package/src/i18n/translation.json +0 -1
- package/src/i18n/zh.json +0 -1
- 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
|
@@ -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","s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,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
|
+
}>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRangeAction = 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.getRangeAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.excelAuth,
|
|
11
|
+
name: 'get_range',
|
|
12
|
+
displayName: 'Get Cells in Range',
|
|
13
|
+
description: 'Retrieve the values in a given cell range (e.g., “A1:C10”).',
|
|
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 retrieve, in A1 notation (e.g., "A1:C10").',
|
|
20
|
+
required: true
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
run(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const { workbook_id, worksheet_id, range } = context.propsValue;
|
|
26
|
+
const { access_token } = context.auth;
|
|
27
|
+
if (!/^[A-Z]+[1-9][0-9]*(:[A-Z]+[1-9][0-9]*)?$/.test(range)) {
|
|
28
|
+
throw new Error('Invalid range format. Please use A1 notation (e.g., "A1" or "A1:C5").');
|
|
29
|
+
}
|
|
30
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
31
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
32
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/${worksheet_id}/range(address='${range}')`,
|
|
33
|
+
authentication: {
|
|
34
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
35
|
+
token: access_token
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
// The response body contains the workbookRange object with details
|
|
39
|
+
// like values, text, formulas, rowCount, etc.
|
|
40
|
+
return response.body;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=get-cells-in-range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cells-in-range.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/get-cells-in-range.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,uCAAwC;AACxC,6CAA+C;AAElC,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,6DAA6D;IAC1E,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,kEAAkE;YACpE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAChE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAEtC,IAAI,CAAC,0CAA0C,CAAC,IAAI,CAAC,KAAe,CAAC,EAAE,CAAC;gBACtE,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;YACJ,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,oBAAW,CAAC,OAAO,UAAU,WAAW,wBAAwB,YAAY,mBAAmB,KAAK,IAAI;gBAChH,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,YAAY;iBACpB;aACF,CAAC,CAAC;YAEH,mEAAmE;YACnE,8CAA8C;YAC9C,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const getRowAction: 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
|
+
row_id: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRowAction = 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
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
10
|
+
exports.getRowAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: index_1.excelAuth,
|
|
12
|
+
name: 'getRowById',
|
|
13
|
+
displayName: 'Get Row by ID',
|
|
14
|
+
description: ' Retrieve the entire content of a row by its row ID.',
|
|
15
|
+
props: {
|
|
16
|
+
workbook_id: common_1.excelCommon.workbook_id,
|
|
17
|
+
worksheet_id: common_1.excelCommon.worksheet_id,
|
|
18
|
+
table_id: common_1.excelCommon.table_id,
|
|
19
|
+
row_id: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Row ID (Index)',
|
|
21
|
+
description: 'The zero-based index of the row to retrieve (e.g., 0 for the first row, 1 for the second).',
|
|
22
|
+
required: true
|
|
23
|
+
})
|
|
24
|
+
},
|
|
25
|
+
run(context) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var _a;
|
|
28
|
+
const { workbook_id, table_id, row_id } = context.propsValue;
|
|
29
|
+
const { access_token } = context.auth;
|
|
30
|
+
const maxRetries = 3;
|
|
31
|
+
let attempt = 0;
|
|
32
|
+
while (attempt < maxRetries) {
|
|
33
|
+
try {
|
|
34
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
35
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
36
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/tables/${table_id}/rows/itemAt(index=${row_id})`,
|
|
37
|
+
authentication: {
|
|
38
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
39
|
+
token: access_token
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return response.body;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
const httpError = error;
|
|
46
|
+
if (((_a = httpError.response) === null || _a === void 0 ? void 0 : _a.status) === 503 && attempt < maxRetries - 1) {
|
|
47
|
+
const delayMs = Math.pow(2, attempt) * 1000;
|
|
48
|
+
console.warn(`Excel API is unavailable (503). Retrying after ${delayMs}ms... (Attempt ${attempt + 1}/${maxRetries})`);
|
|
49
|
+
yield delay(delayMs);
|
|
50
|
+
attempt++;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
throw new Error('Failed to retrieve row after multiple retries due to API unavailability.');
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=get-row-by-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-row-by-id.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/get-row-by-id.ts"],"names":[],"mappings":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AAC;oBACH,OAAO,QAAQ,CAAC,IAAI,CAAC;gBACvB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,SAAS,GAAG,KAAkB,CAAC;oBACrC,IAAI,CAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,IAAI,OAAO,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC;wBACnE,MAAM,OAAO,GAAG,SAAA,CAAC,EAAI,OAAO,CAAA,GAAG,IAAI,CAAC;wBACpC,OAAO,CAAC,IAAI,CACV,kDAAkD,OAAO,kBACvD,OAAO,GAAG,CACZ,IAAI,UAAU,GAAG,CAClB,CAAC;wBACF,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;wBACrB,OAAO,EAAE,CAAC;oBACZ,CAAC;yBAAM,CAAC;wBACN,MAAM,KAAK,CAAC;oBACd,CAAC;gBACH,CAAC;YACH,CAAC;YACD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getWorksheetAction: 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
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorksheetAction = 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.getWorksheetAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: index_1.excelAuth,
|
|
11
|
+
name: 'get_worksheet',
|
|
12
|
+
displayName: 'Get Worksheet by ID',
|
|
13
|
+
description: 'Retrieve metadata of a worksheet by its ID.',
|
|
14
|
+
props: {
|
|
15
|
+
workbook_id: common_1.excelCommon.workbook_id,
|
|
16
|
+
worksheet_id: common_1.excelCommon.worksheet_id, // This dropdown provides the worksheet name as its value
|
|
17
|
+
},
|
|
18
|
+
run(context) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const { workbook_id, worksheet_id } = context.propsValue;
|
|
21
|
+
const { access_token } = context.auth;
|
|
22
|
+
// The worksheet_id prop from excelCommon returns the worksheet's name,
|
|
23
|
+
// which can be used to identify it in the API URL as per the documentation ({id|name}).
|
|
24
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
26
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/${worksheet_id}`,
|
|
27
|
+
authentication: {
|
|
28
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
29
|
+
token: access_token,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
// The response body contains the workbookWorksheet object with its metadata.
|
|
33
|
+
return response.body;
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=get-worksheet-by-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-worksheet-by-id.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/get-worksheet-by-id.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAyF;AACzF,uCAAwC;AACxC,6CAA+C;AAElC,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE;QACH,WAAW,EAAE,oBAAW,CAAC,WAAW;QACpC,YAAY,EAAE,oBAAW,CAAC,YAAY,EAAE,yDAAyD;KACpG;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACzD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAEtC,uEAAuE;YACvE,wFAAwF;YACxF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,oBAAW,CAAC,OAAO,UAAU,WAAW,wBAAwB,YAAY,EAAE;gBACtF,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,YAAY;iBACtB;aACJ,CAAC,CAAC;YAEH,6EAA6E;YAC7E,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const renameWorksheetAction: 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
|
+
new_name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renameWorksheetAction = 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
|
+
const namingRules = `
|
|
10
|
+
The new name for the worksheet. The name must adhere to the following rules:
|
|
11
|
+
- Cannot be blank.
|
|
12
|
+
- Cannot exceed 31 characters.
|
|
13
|
+
- Must not contain any of the following characters: \`/\`, \`\\\`, \`?\`, \`*\`, \`:\`, \`[\`, \`]\`.
|
|
14
|
+
- The name "History" is reserved by Excel and cannot be used.
|
|
15
|
+
`;
|
|
16
|
+
exports.renameWorksheetAction = (0, pieces_framework_1.createAction)({
|
|
17
|
+
auth: index_1.excelAuth,
|
|
18
|
+
name: 'rename_worksheet',
|
|
19
|
+
displayName: 'Rename Worksheet',
|
|
20
|
+
description: 'Change the name of an existing worksheet.',
|
|
21
|
+
props: {
|
|
22
|
+
workbook_id: common_1.excelCommon.workbook_id,
|
|
23
|
+
worksheet_id: common_1.excelCommon.worksheet_id,
|
|
24
|
+
new_name: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'New Worksheet Name',
|
|
26
|
+
description: namingRules,
|
|
27
|
+
required: true
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
run(context) {
|
|
31
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const { workbook_id, worksheet_id, new_name } = context.propsValue;
|
|
33
|
+
const { access_token } = context.auth;
|
|
34
|
+
// The worksheet_id prop from excelCommon returns the worksheet's current name,
|
|
35
|
+
// which can be used to identify it in the API URL.
|
|
36
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
37
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
38
|
+
url: `${common_1.excelCommon.baseUrl}/items/${workbook_id}/workbook/worksheets/${worksheet_id}`,
|
|
39
|
+
authentication: {
|
|
40
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
41
|
+
token: access_token
|
|
42
|
+
},
|
|
43
|
+
body: {
|
|
44
|
+
name: new_name
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return response.body;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=rename-worksheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename-worksheet.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-excel-365/src/lib/actions/rename-worksheet.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,uCAAwC;AACxC,6CAA+C;AAE/C,MAAM,WAAW,GAAG;;;;;;CAMnB,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE;QACL,WAAW,EAAE,oBAAW,CAAC,WAAW;QACpC,YAAY,EAAE,oBAAW,CAAC,YAAY;QACtC,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACnE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAEtC,+EAA+E;YAC/E,mDAAmD;YACnD,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,KAAK;gBACxB,GAAG,EAAE,GAAG,oBAAW,CAAC,OAAO,UAAU,WAAW,wBAAwB,YAAY,EAAE;gBACtF,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,YAAY;iBACpB;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACf;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -6,11 +6,11 @@ export declare const excelCommon: {
|
|
|
6
6
|
values: import("@activepieces/pieces-framework").DynamicProperties<true>;
|
|
7
7
|
table_values: import("@activepieces/pieces-framework").DynamicProperties<true>;
|
|
8
8
|
parent_folder: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
9
|
-
getHeaders: (workbookId: string, accessToken: string, worksheetId: string) => Promise<string[]>;
|
|
9
|
+
getHeaders: (workbookId: string, accessToken: string, worksheetId: string) => Promise<(string | number | boolean)[]>;
|
|
10
10
|
getTableHeaders: (workbookId: string, accessToken: string, worksheetId: string, tableId: string) => Promise<any>;
|
|
11
11
|
getLastUsedRow: (workbookId: string, worksheetId: string, accessToken: string) => Promise<number>;
|
|
12
|
-
getLastUsedColumn: (workbookId: string, worksheetId: string, accessToken: string) => Promise<
|
|
13
|
-
getAllRows: (workbookId: string, worksheetId: string, accessToken: string) => Promise<
|
|
12
|
+
getLastUsedColumn: (workbookId: string, worksheetId: string, accessToken: string) => Promise<string>;
|
|
13
|
+
getAllRows: (workbookId: string, worksheetId: string, accessToken: string) => Promise<(string | number | boolean)[][]>;
|
|
14
14
|
numberToColumnName: (num: number) => string;
|
|
15
15
|
getAllFolders: (folderId: string, authToken: string, currentPath: string) => Promise<{
|
|
16
16
|
id: string;
|