I would like to test for the existing of an external file from within a cell formulae e.g.
if c:\users\carl\tst.txt exists then output "Yes" otherwise output ""
Is this possible in OO Calc?
Any help much appreciated
[SOLVED] How do I test for an external file?
[SOLVED] How do I test for an external file?
Last edited by MrProgrammer on Thu Aug 01, 2019 8:30 pm, edited 3 times in total.
Reason: Moved from Calc forum to OpenOffice Basic, Python, BeanShell, JavaScript
Reason: Moved from Calc forum to OpenOffice Basic, Python, BeanShell, JavaScript
OpenOffice 4.1.6 on Windows 10 64-bit
Re: How do I test for an external file?
Welcome to the Forums.
Based on the wording of your request, while Calc might be able to do this, I believe it would require a macro.
I'm not familiar with macros, but a quick Google search brought up https://stackabuse.com/python-check-if- ... ry-exists/
As this is a Python code, it (to my knowledge) is compatible with Calc, and thus may be what you are wanting.
Based on the wording of your request, while Calc might be able to do this, I believe it would require a macro.
I'm not familiar with macros, but a quick Google search brought up https://stackabuse.com/python-check-if- ... ry-exists/
As this is a Python code, it (to my knowledge) is compatible with Calc, and thus may be what you are wanting.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Re: How do I test for an external file?
You can test it with a macro written in the Basic. The Basic has IDE in the AOO/LO. The usage of the Basic maybe easier than the Python for a beginner.
Copy the code into a Module of the MyMacros, and then you will able to call the function from a cell of any spreadsheet document.
Code: Select all
REM ***** BASIC *****
Option explicit
Function MyFileExists(sFullPath as string) as boolean
dim sFileUrl as string
sFileURL = ConvertToUrl(sFullPath)
If FileExists(sFileUrl) then
MyFileExists = True
else
MyFileExists = False
end if
End function
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.