FindSheetName
Back to ListDescription: Searches the sheets in a workbook for a sheet name, and returns it sheetID
FileMaker Prototype:
Set Variable [$res; ACF_Run("FindSheetName"; int_wb; string_name)]
Category: EXCEL
Function source:
// Function: FindSheetName
// Description: Finds the sheet ID for a given sheet name in a workbook.
// Parameters:
// - wb: The workbook identifier (integer).
// - name: The name of the sheet to locate (string).
// Returns:
// - The sheet ID (integer) if the sheet with the given name is found.
// - Returns -1 if the sheet is not found.
function FindSheetName(int wb, string name)
int sheetCount = Excel_CountSheets(wb); // Get the total number of sheets in the workbook
int i, s;
// Iterate through all sheets, starting from the second sheet (index 2)
for (i = 2, sheetCount )
s = Excel_getSheetID(wb, i); // Get the sheet ID for the current sheet
// Check if the sheet name matches the given name
if (name == Excel_GetSheetName(s)) then
return s; // Return the sheet ID if a match is found
end if
end for
// Return -1 if no sheet with the given name is found
return -1;
end