I have to convert .las
files in one directory to .xlsx
files using las2excelbulk
function.
Currently I can do that in command prompt but I want to do it using Python: is it possible?
Here's the link which i referred https://lasio.readthedocs.io/en/latest/exporting.html
Open CMD
switch to the folder having las files using " cd
las2excelbulk -r -i
The file would be converted.
# this is working for only one file
import lasio
las = lasio.read('*.las')
las.to_excel('testsamplelas.xlsx')
The argument to
lasio.read()
can only be a single filename, but you can use theos
andfnmatch
modules in the Python standard library to step through all .las files recursively.lasio.read(..., ignore_header_errors=True)
is the equivalent oflas2excelbulk -i
.It may also be useful to inspect the code behind the
las2excelbulk
command line tool for more information.