473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Extract data from an Excel file and put into another

Hi

I have an application where I need to manipulate data in a Dbf file(File1), search a second file (File2) for a tagname and scale the value before populating a third file (File3) with the result.

This is how I think it should work, but how do I do it, I'm not very good with VB!


Open DbfFile (File1)

Click on macro Button

Open Eventlogged Tags File (File2)

Concatenate Addr and Rtu ie 41R24
Concatenate Date/time Columns 26/06/2007 12:35:00:000

Search Eventlogged tags file (File2) for register Number (ItemName)

If Found

Find Tagname
Find Min Raw Scale
Find Max Raw Scale
Find Min EU Scale
Find Max EU Scale
Scale Raw Value from Log File
Create String

File 3 Shows the format required. The first 3 Rows are simply a header and the rest being the data and a few extra fields.

Write to File3
repeat until EOF
Save file3 as filename= datetime.logs
Close All
Exit Excel

Example File 1

DATE TIME LABEL PRI RTU ADDR VALUE USER
05/06/07 12:41:20.03 Label 0 10 #R24 126 1
05/06/07 12:41:10.02 Label 0 10 #R24 116 1
05/06/07 12:41:00.01 Label 0 10 #R24 106 1

File 2 Example

:IOReal Comment EngUnits MinEU MaxEU MinRaw MaxRaw ItemName
RES032_CL01_Residual Waipu CL2 Residual g/m³ 0 5 0 32767 32R26
RES036_CL01_Residual Parua Bay CL2 Residual g/m³ 0 5 0 32767 36R27
RES036_PH01_PH Parua Bay PH Level pH 0 14 0 32767 36R24
RES040_CL01_Residual Fairway Drive Res Final CL2 g/m³ 0 5 0 32767 40R27
RES040_PH01_PH Fairway Drive Res Final PH pH 0 14 0 32767 40R28
RES041_CL01_Residual Hikurangi CL2 Residual g/m³ 0 5 0 32767 41R27
RES041_PH01_PH Hikurangi PH Level pH 0 14 0 32767 41R24

Example File 3

ASCII
,
wwadmin,1,New Zealand Daylight Time,10,1
ENV_TP4109,1,2006/11/17,15:44:40.026,1,40,192
ENV_TP4109,1,2006/11/17,15:44:50.048,1,50,192
ENV_TP4109,1,2006/11/17,15:45:00.052,1,0,192


Cheers

Eugene
Jun 5 '07 #1
1 2843
Hi

I have an application where I need to manipulate data in a Dbf file(File1), search a second file (File2) for a tagname and scale the value before populating a third file (File3) with the result.

This is how I think it should work, but how do I do it, I'm not very good with VB!


Open DbfFile (File1)

Click on macro Button

Open Eventlogged Tags File (File2)

Concatenate Addr and Rtu ie 41R24
Concatenate Date/time Columns 26/06/2007 12:35:00:000

Search Eventlogged tags file (File2) for register Number (ItemName)

If Found

Find Tagname
Find Min Raw Scale
Find Max Raw Scale
Find Min EU Scale
Find Max EU Scale
Scale Raw Value from Log File
Create String

File 3 Shows the format required. The first 3 Rows are simply a header and the rest being the data and a few extra fields.

Write to File3
repeat until EOF
Save file3 as filename= datetime.logs
Close All
Exit Excel

Example File 1

DATE TIME LABEL PRI RTU ADDR VALUE USER
05/06/07 12:41:20.03 Label 0 10 #R24 126 1
05/06/07 12:41:10.02 Label 0 10 #R24 116 1
05/06/07 12:41:00.01 Label 0 10 #R24 106 1

File 2 Example

:IOReal Comment EngUnits MinEU MaxEU MinRaw MaxRaw ItemName
RES032_CL01_Residual Waipu CL2 Residual g/m³ 0 5 0 32767 32R26
RES036_CL01_Residual Parua Bay CL2 Residual g/m³ 0 5 0 32767 36R27
RES036_PH01_PH Parua Bay PH Level pH 0 14 0 32767 36R24
RES040_CL01_Residual Fairway Drive Res Final CL2 g/m³ 0 5 0 32767 40R27
RES040_PH01_PH Fairway Drive Res Final PH pH 0 14 0 32767 40R28
RES041_CL01_Residual Hikurangi CL2 Residual g/m³ 0 5 0 32767 41R27
RES041_PH01_PH Hikurangi PH Level pH 0 14 0 32767 41R24

Example File 3

ASCII
,
wwadmin,1,New Zealand Daylight Time,10,1
ENV_TP4109,1,2006/11/17,15:44:40.026,1,40,192
ENV_TP4109,1,2006/11/17,15:44:50.048,1,50,192
ENV_TP4109,1,2006/11/17,15:45:00.052,1,0,192


Cheers

Eugene

you can create a macro in excel and then by visual basic you can call/activate that macro
Jun 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dianna K | last post by:
I am opening, reading and extracting an Excel spreadsheet in .Net (VB). It seems to work fine, however, when I am finished and I open up Excel and try to open up the file a message pops up "File Now...
9
by: Brian Hanson | last post by:
Hi, I have an unusual problem that just showed its ugly head at a pretty bad time. I have an asp.net (VB) app that takes data from an Excel sheet and puts it into SQL Server. I get the data...
1
by: Beginner | last post by:
hihi While I am developing ASP.NET using C# I want to import a excel file and make some modification and then generate a report however, I can't use SQL command as the excel file does not have...
17
by: Philip Wagenaar | last post by:
I have an excel sheet that has several lines. Each line is an order. Example: 1 Paper 10 2 Pencils 20 etc... When the excel sheet is filled out I want the user to press a...
15
by: John Machin | last post by:
I am pleased to announce a new general release (0.5.2) of xlrd, a Python package for extracting data from Microsoft Excel spreadsheets. CHANGES: * Book and sheet objects can now be pickled and...
3
by: maylee21 | last post by:
hi, anyone can help me figure out how to read data from a text file like this: 10980012907200228082002 and extract the data according to this kind of format: Record type 1 TY-RECORD ...
1
by: manishabh77 | last post by:
I will be obliged if anybody can help me with this problem: I am trying to extract data from an excel sheet that matches IDs given in column 4 of the excel sheet.I have stored those query IDs in an...
1
by: veer | last post by:
Hi i am making a program in which i want to extract data from html file . Actually there are two dates on html file i want to extract these dates but the main probleum is that these dates are...
0
by: =?ISO-8859-1?Q?J=F6rg_Battermann?= | last post by:
Hello there, Is there any -reliable- way to extract certain, given ranges in excel files into either a picture (each) or into proper xhtml? I am asking because I am currently automating a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.