Skip to content

Commit 649c3e6

Browse files
committed
improvement(microsoft-excel): add File Source dropdown to control SharePoint visibility
Replace always-visible optional SharePoint fields with a File Source dropdown (OneDrive/SharePoint) that conditionally shows site and drive selectors. OneDrive users see zero extra fields (default). SharePoint users switch the dropdown and get the full cascade.
1 parent 2884587 commit 649c3e6

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

apps/sim/blocks/blocks/microsoft_excel.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,20 +394,34 @@ export const MicrosoftExcelV2Block: BlockConfig<MicrosoftExcelV2Response> = {
394394
placeholder: 'Enter credential ID',
395395
required: true,
396396
},
397-
// SharePoint Site Selector (basic mode, optional)
397+
// File Source selector (basic mode)
398+
{
399+
id: 'fileSource',
400+
title: 'File Source',
401+
type: 'dropdown',
402+
options: [
403+
{ label: 'OneDrive', id: 'onedrive' },
404+
{ label: 'SharePoint', id: 'sharepoint' },
405+
],
406+
value: () => 'onedrive',
407+
mode: 'basic',
408+
},
409+
// SharePoint Site Selector (basic mode, only when SharePoint is selected)
398410
{
399411
id: 'siteSelector',
400-
title: 'SharePoint Site (Optional)',
412+
title: 'SharePoint Site',
401413
type: 'file-selector',
402414
canonicalParamId: 'siteId',
403415
serviceId: 'sharepoint',
404416
selectorKey: 'sharepoint.sites',
405417
requiredScopes: [],
406-
placeholder: 'Select a SharePoint site (leave empty for OneDrive)',
418+
placeholder: 'Select a SharePoint site',
407419
dependsOn: ['credential'],
420+
condition: { field: 'fileSource', value: 'sharepoint' },
421+
required: { field: 'fileSource', value: 'sharepoint' },
408422
mode: 'basic',
409423
},
410-
// SharePoint Drive Selector (basic mode, only visible when a site is selected)
424+
// SharePoint Drive Selector (basic mode, only when SharePoint is selected)
411425
{
412426
id: 'driveSelector',
413427
title: 'Document Library',
@@ -418,6 +432,8 @@ export const MicrosoftExcelV2Block: BlockConfig<MicrosoftExcelV2Response> = {
418432
selectorAllowSearch: false,
419433
placeholder: 'Select a document library',
420434
dependsOn: ['credential', 'siteSelector'],
435+
condition: { field: 'fileSource', value: 'sharepoint' },
436+
required: { field: 'fileSource', value: 'sharepoint' },
421437
mode: 'basic',
422438
},
423439
// Spreadsheet Selector (basic mode)
@@ -580,6 +596,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
580596
cellRange,
581597
driveId,
582598
siteId: _siteId,
599+
fileSource: _fileSource,
583600
...rest
584601
} = params
585602

@@ -610,6 +627,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
610627
},
611628
inputs: {
612629
operation: { type: 'string', description: 'Operation to perform' },
630+
fileSource: { type: 'string', description: 'File source (onedrive or sharepoint)' },
613631
oauthCredential: { type: 'string', description: 'Microsoft Excel access token' },
614632
siteId: { type: 'string', description: 'SharePoint site ID (used for drive/file browsing)' },
615633
driveId: { type: 'string', description: 'Drive ID for SharePoint document libraries' },

0 commit comments

Comments
 (0)