Auto import data from text files into Excel spreadsheet and merge

scottryan

New Member
Joined
Aug 3, 2016
Messages
4
I'm trying to automate my data import method to save time. Right now 2 text files are created and saved in a folder before being opened in Excel, the required data highlighted and then copied and pasted into the relevant cells in the ROPdata sheet shown below.

The first file is called ROP-Gas.txt and contains 3 columns delimited by spaces. The first column is Depth, second is ROP and the third is Gas. After going through Text Import Wizard, it looks like this:

ROP-Gas.txt

ABC
15000.62.18
2500.20.62.18
3500.40.62.18
4500.60.62.18
5500.80.62.19
65010.62.19
7501.20.62.2

<tbody>
</tbody>

So, the file is opened and the ROP and Gas columns highlighted and copied to the clipboard before going to the ROPdata sheet and the matching Depth value and pasted in.

The second file is called gamma.las that contains a header and columns of data. The header isn't relevant but the columns are - the first is Depth and the second is Gamma. It's also space delimited and looks like this after going through the Import Text Wizard:

gamma.las

ABCDEF
1~VERSIONINFORMATION
2VERS.2:CWLSLOGASCII
3WRAP.NO:ONELINEPER
4PHXV.1.4.1.14:PhoenixLASGeneratorVersion
5VDAT.########8:58:00:PhoenixLASBuild
6~WELLINFORMATION
7#MNEM.UNITDATADESCRIPTION
8#-------------------------------------------
9STRT.M139:STARTDEPTH
10STOP.M2175:STOPDEPTH
11STEP.M0.2:STEP
12NULL.-999.25:NULLVALUE
13WELL.:WellName
14RIG.:RigName
15COMP.:ClientName
16CTRY.CA:Country
17PROV.MB:Province
18LOC.:SurfaceLocation
19UWI.:UniqueWellID
20PDAT.GroundLevel:Permanent
21DMF.KellyBushing:Drilling
22KB.M535.53:KellyBushing
23GL.M531.33:GroundLevel
24DATE.2018630:
25CREATED.201873:
26LIC.:WellLicenseNumber
27LATI.DEG:Latitude
28LONG.DEG:Longitude
29SRVC.:ServiceCompany
30FLD.:Field
31~CURVEINFORMATION
32#MNEM.UNITAPICODESCURVEDESCRIPTION
33#-------------------------------------------
34DEPT.M1:DEPTH
35MG1C.API:GammaRay(Corrected)
36DVER.M960:HoleTVD
37ROPA.M/HR:RateofPenetration
38~ADEPTMG1CDVERROPA
3950034.94139-999.25
40500.236.39139.224.87
41500.437.85139.450.25
42500.639.3139.652.44
43500.639.85139.858.81
44500.840.3914069.81
4550140.94140.276.01
46501.241.49140.474.11

<tbody>
</tbody>

Same thing with the gamma.las file - the gamma values are highlighted, copied to the clipboard and then pasted into the ROPdata sheet based on the matching depth values.

Excel tables to the web >> Excel Jeanie HTML 4

ROPdata

ABCDEFGHI
1SlideDepthROP (min/m)Gas (%)Gamma (cps)TVDSubsea ElevationPlotted GasPlotted Gamma
2500.0496.62-496.620.00.0
3500.2496.82-496.820.00.0
4500.4497.02-497.020.00.0
5500.6497.22-497.220.00.0
6500.8497.42-497.420.00.0
7501.0497.61-497.610.00.0
8501.2497.81-497.810.00.0
9501.4498.01-498.010.00.0
10501.6498.21-498.210.00.0
11501.8498.41-498.410.00.0
12502.0498.61-498.610.00.0
13502.2498.80-498.800.00.0
14502.4499.00-499.000.00.0
15502.6499.20-499.200.00.0
16502.8499.40-499.400.00.0
17503.0499.60-499.600.00.0

<tbody>
</tbody>


I'd like to automate this process as much as possible. This data comes from drilling oil wells and is depth based so the depth keeps increasing and new ROP, Gas and Gamma data is generated every 0.2 meters. The ROP-Gas.txt and gamma.las files are periodically overwritten in their folder keeping the file name the same but containing new depth based data. When that happens I'd like to automatically import these new values into the ROPdata sheet and have the ROP, Gas and Gamma data put into the cells with the matching Depth values.

I hope that I've explained what I'd like to do clearly - any help would be greatly appreciated.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,215,787
Messages
6,126,897
Members
449,347
Latest member
Macro_learner

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top