ajFileExists function
Description
The ajFileExists function checks whether a specified file exists or not.
Syntax
ajFileExists(file_path, [run_condition], [run_by_function_point_only])
Argument Name | Argument Type | Description |
---|---|---|
file_path (required) | String | The path of the file. Both the forward-slash (/) and backslash (\) are supported as the folder separator. |
run_condition (optional) | Boolean | The function will run when the value is TRUE. Otherwise will not run. The default value is TRUE. |
run_by_function_point_only (optional) | Boolean | If it equals FALSE, the function can be executed through ‘Excel Calculation’ (it can be either Automatic or Manual, Calculate Now or Calculate Sheet) or Preview Function Point. If it equals TRUE, the function can be executed with Preview Function Point (AlchemyJ ribbon / Preview Function Point) only. The default value is TRUE. |
The function will return:
1) Return Value: TRUE, FALSE
2) Return Type: Single Value / Multiple values (array formula)
Example
=ajFileExists("c:\source.txt")
If the file exists, the function returns TRUE. Otherwise, it returns FALSE.
Click here to download the use case workbooks for further reference.
Error Scenarios
It will return #VALUE! when missing any required parameter or mismatch parameter type.