3

I need to link to an Excel file in Access but there are a bunch of needless rows that come before the actual header + data. Is there a way to skip the first few rows when importing this Excel file and tell it where the header is?

Note: I cannot modify the source Excel file directly. The files are provided as-is.

IAmBatman
  • 687
  • 1
  • 10
  • 20

1 Answers1

2

Link the sheet using the Range parameter with DoCmd.TransferSpreadsheet, as in this example from the DoCmd.TransferSpreadsheet Method help topic.

DoCmd.TransferSpreadsheet acImport, 3, _
    "Employees","C:\Lotus\Newemps.wk3", True, "A1:G12"
HansUp
  • 95,961
  • 11
  • 77
  • 135
  • "External table is not in the expected format" is the error I get when I try this on my .xls file. Do I need to do something more? – IAmBatman Oct 08 '12 at 17:12
  • Removing the 3 worked (had to do with Excel versions I think). Thank you so much!! – IAmBatman Oct 08 '12 at 17:14
  • Oops, right. That wasn't the best example to give you. I just copied it to show the Range parameter in use. But that sample was for an old Lotus spreadsheet format. And since you want to link instead of import the sheet, it should be `acLink` instead of `acImport`. – HansUp Oct 08 '12 at 17:18