473,405 Members | 2,344 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,405 software developers and data experts.

Import Excel File without Specific Rows

5
Is there a way to automate a process to import an excel spreadsheet without the first and last couple of rows into Access?
Mar 16 '10 #1
10 8418
TheSmileyCoder
2,322 Expert Mod 2GB
If you do it through VBA you can specify the range to import. Is it always the same rows/range you are importing?
Mar 16 '10 #2
Lipper
5
As of now yes. I am receiving an excel file that will come in the same format periodically.
Mar 16 '10 #3
NeoPa
32,556 Expert Mod 16PB
Check out the TransferSpreadsheet method in the help, but the sixth parameter is Range. It will allow you to specify exactly what to include.
Mar 16 '10 #4
Lipper
5
Thanks, I used the following code below, and it works out pretty good.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
  2.     "Worksheet Name", "Path Name", True, "Range"
Mar 16 '10 #5
Lipper
5
Say the "Range" may change from time to time, and I was trying to find an easier way to input the cell range other than directly into the code, any ideas?
Mar 16 '10 #6
TheSmileyCoder
2,322 Expert Mod 2GB
Would depend on the specific situation. One way could be to import it all, then delete the offending rows.

Another approach could be to open an excel application via VBA (can be hidden from user), open the sheet, and programmatically set/check the range, provided you have something that computer logic can use to determine the range. Would have to see an example to help you with that.
Mar 16 '10 #7
NeoPa
32,556 Expert Mod 16PB
@Lipper
Essentially no. There are ways around it, but they're cumbersome. This was the point of the question in post #2 of course.
Mar 17 '10 #8
TheSmileyCoder
2,322 Expert Mod 2GB
You can open the excel sheet, and make a named range, and have the transferspreadsheet function always import the named range.
Mar 17 '10 #9
Lipper
5
I want to thank you both for helping me out with this. One more thought, do any of you know any method that will exclude a number of top rows as opposed to defining a range?
Mar 17 '10 #10
NeoPa
32,556 Expert Mod 16PB
For a Range parameter, you either need to know that the range is named, and use that, or you need to be able to specify the range in one of the standard formats, "A1:B2" or "R1C1:R2C2". Clearly you could specify a range that missed the top X rows, but that would leave you required to specify which row to go down to too. You could mix this with an earlier suggestion, to import line X+1 to 65,536, and then delete all records with no data, but without access to the Excel file itself, and with no prior knowledge as to how many lines are there, you will not be in a position to specify a meaningful range.
Mar 17 '10 #11

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

Similar topics

0
by: Zero | last post by:
how to Overwrite Existing Excel File without prompt and quit?
7
by: alwayssmiling | last post by:
Hi frends, In my application, a class supports backend processing. In this class im creating a new excel sheet and im inserting some data into this excel sheet, and im trying to save the file...
2
by: solargovind | last post by:
Hi, Can anybody suggest me how to take data from an Excel file without import into Access as a Table..? Bcoz...I hve several file. if i import, it would take more time and increase the file...
8
by: qfchen | last post by:
Hi, A piece of simple code to import excel file to a database, as shown below, I have problem when I tried to open the connection, the error message shows Excel driver is not correct. where shall...
2
by: jitendrawel | last post by:
how can be import excel file in mysql database through PHP code. Please send me complete code ASAP. Thanks. Best regards, Jitendra Kumar
1
by: vikassawant | last post by:
Hi, I want to import Excel file data in JTable.For that I am using following Code, String excelFileName = "Team1.xls"; File file = new File(excelFileName ); //‘file’ is the file you...
1
by: orked | last post by:
i tried to import excel file into gridview but the code made this exception (Failed to map this path''xmlTest.xml") i don't know why my code: public void fillGrid() { DataSet ds =...
4
by: orked | last post by:
i want to import excel file to gridview but there was error(Failed to map this path "/xmltest.xml") and i couldn't handle it my code: public void fillGrid() { DataSet ds = new...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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
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,...

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.