473,654 Members | 3,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading data in to Access From Excel

Hi all,
I am fairly new to VB.I am trying to figure out as how to write a
script so that i can read the data from an excel sheet to Access.

can u guys please help me out?

cheers,
nuti

Jan 4 '06 #1
13 13221
The simplest way is to connect to the Excel data via:
File | Get External
You can link if the data is regularly updated in Excel and you want the
latest data, or import if you want to operate on the data in Access without
affecting the spreadsheet.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"nuti" <nu********@yah oo.co.in> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi all,
I am fairly new to VB.I am trying to figure out as how to write a
script so that i can read the data from an excel sheet to Access.

can u guys please help me out?

Jan 4 '06 #2
Hi,
Thanks Allen ....But i want to automate it by writing a macro in the
excel sheet.
On running the macro it should write the data in to access.
can you send me the code for it?

cheers,
Nuti

Jan 4 '06 #3
From in Access, you would use the TransfrerSpread sheet action to get stuff
from Excel

If you want do know how to do it in Excel, you might ask in one of the Excel
groups.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"nuti" <nu********@yah oo.co.in> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi,
Thanks Allen ....But i want to automate it by writing a macro in the
excel sheet.
On running the macro it should write the data in to access.
can you send me the code for it?

Jan 4 '06 #4
Hi Allen,
Canu kindly let me know as how we can use TransferSpreads heet to import
the data from excel?

cheers,
Nuti

Jan 4 '06 #5
This works from inside Access.

Choose the Macros tab of the Database window, and click New.
Choose the TransferSpreads heet action.
In the lower pane, enter the parameters.

If you prefer to work in VBA code rather than the Access macros, the code
would be something like this:
DoCmd.TransferS preadsheet acImport, , "Table1", "C:\MyFile. xls"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"nuti" <nu********@yah oo.co.in> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Hi Allen,
Canu kindly let me know as how we can use TransferSpreads heet to import
the data from excel?

cheers,
Nuti

Jan 4 '06 #6
Hi Allen,

Its working fine with trasferspreadsh eets action.

Is it so that the code snippet that u hav send works from the excel
macro?

Thanks A lot

cheers,
Nuti

Jan 4 '06 #7
HI Allen,

DoCmd.TransferS preadsheet acImport, , "Table1", "C:\MyFile. xls"

The code is working fine.But i want to give the path of the excel
dynamically.
i mean we should give the name of the excel sheet.

cheers,
Nuti

Jan 4 '06 #8
If you want to programmaticall y pop up a dialog asking for the file name,
there's a bit more to it:
http://www.mvps.org/access/api/api0001.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"nuti" <nu********@yah oo.co.in> wrote in message
news:11******** ************@o1 3g2000cwo.googl egroups.com...
HI Allen,

DoCmd.TransferS preadsheet acImport, , "Table1", "C:\MyFile. xls"

The code is working fine.But i want to give the path of the excel
dynamically.
i mean we should give the name of the excel sheet.

cheers,
Nuti

Jan 4 '06 #9
Red
Okay, I'm ALL over this one :D

Sorry for taking so long to reply... Excel to Access is my specialty...
I may not know anything about anything else, but, if you want to get
data in between access and excel, I'm an expert :D
The idea of using the transferspreads heet is a good one, if your
spreadsheet is a spreadhseet that looks like a copy of a table......
but as we all know, noob boses don't know anything about making a table
looking spreadsheet.. they just want to see pretty colors, and
lines....

Depending on if the spreadsheet will be the same or not, your code will
differ...

I will head you in the right direction though... to start....

First, start excel with a :
Dim XLS
Set XLS = CreateObject("E xcel.Applicatio n")
XLS.Application .Visible = True

This opens Excel, and makes it visible....

Next you need to open the file with a
XLS.application .workbooks.open "Filename here"

You have to use the whole path for the file name, and the extension...
i.e. "c:\program files\msoffice\ templates\myfil e.xls"

After you have the file open, you can easily maniuplate what you need
with if's and where, and do until's...
Like this will find the first box that contains nothing (in the first
column):

Dim X as integer
do until wkb.cells(X,1) = ""
x = x + 1
loop

another note, when using cells, it's ALWAYS cells(ROWS, COLUMNS)...
lord knows I'vehad my mishaps switching them around :D

Once you get all that down, feel free to ask more questions about excel
interfacing

~Red

Jan 4 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4329
by: piero | last post by:
Hi, I have a Excel sheet that have a column with mixed data: column can contain data like "892-234-32A" or like "892298343233432" I need to get all data column such as "text" to avoid numeric field show as exponential number. I'm trying with: SELECT CAST (CODICE as bigint(25)) FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel
4
2584
by: Ajay Tiku | last post by:
Hi every one, I am trying to build an applicatiuon which is supposed to read some data from excel spread sheet. can some one please help me in showing how. The excel file is created by other application and I have no control over it. My application will only open that file and read data from some cols specified by me. Thanks
2
1781
by: thysonj | last post by:
I know the basic way of doing this when you have a static set of spreadsheets but I need to be able to process different spreadsheets every day. These spreadsheets are sent to us by an outside auditing firm without named ranges. They have a consistent format. Is there a way to read a specific set of cells without having a named range? Or is there a way to name a range with ASP? I am open to any options here. Going through and creating...
1
5978
by: madhu sudhan | last post by:
HI, I want to read data from excel file and export this data to dataset. I know abt the basics of opening a file using application, workbook and worksheet classes. But i don't know how to read data from the excel file to populate it into the dataset. I think i have to use the class Range. Can any one explain how to do it ????????????? Thank YOU
1
1364
by: syam217 | last post by:
Please help me out in reading data from Excel file and storing it in SQL Server 2000 database. Its very urgent. Thanks in advance.
5
6776
by: aamax | last post by:
I have to read data from an excel spreadsheet. the first column has a variable number of rows that are associated with one value (which is in only one of the rows, and it's variable about which one). In excel the rows of column 1 are outlined by a nice border and it's easy to see that this particular value corresponds to the 1..n rows in the following columns. It's basically a 1 to many relationship across the spreadsheet. how can I read...
1
1205
by: dixon | last post by:
Hi please help i'm trying to read data from excel file using VB 2005 and display it to a listbox and when name clicked on a list box details of that name should be displayed on the labels such as Initials, Address and contact no...can anyone give me the code
1
10405
by: =?Utf-8?B?U2hlZXMgQWJpZGk=?= | last post by:
I read an article on the link: http://support.microsoft.com/default.aspx?scid=kb;en-us;306572 related to reading data from Excel using OLEDB The topic's heading is: How to query and display excel data by using ASP.NET, ADO.NET, and Visual C# .NET I am trying with the same code in Visual Studio 2005 in ASP.NET application. The code i am using is: protected void Page_Load(object sender, EventArgs e) { String connectionString...
8
3384
ammoos
by: ammoos | last post by:
Hi Friends I am getting the following error when I am trying to read data from an excel sheet using sql script OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. The provider did not give any information about the error. OLE DB error trace . If I save the excel file in the database server machine, then it will work fine.. I am getting this error message when I save the excel file in any other machine in the network and trying...
3
2855
by: Harbin2010 | last post by:
hi, I am trying to read data from an excel file. in one column data is like this: 1 1.1 1.1.1 1.1.2 1.2 1.2.1 1.2.2
0
8285
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8706
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8475
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2709
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.