0

Example of Offset Excel Table

I'm trying to import a table from an Excel file that I have only read-only access to. There is a nicely formatted table in a tab of the file which has all the data I need, but it is offset in the worksheet (it doesn't start at cell A1). There is also other data in the worksheet outside the table that I would like to exclude.

It seems that all normal import operations for T-SQL assume that you have either one row of headers or no headers at all, and I haven't been able to find a way to reference the Excel table specifically. I've tried using the Import/Export Wizard in SQL Server Management Studio, but it doesn't seem to have the options I need.

What's the best workflow for dealing with this kind of challenge?

5
  • What do you mean by, "When not in first Row/Column". Jan 27, 2018 at 11:03
  • The SSMS import wizard expects the data to start in A1 (or headers to start in A1 and data to start in A2). In this case, the data is offset, starting in C3. How to set up the importer to grab only the data I need?
    – Andrew
    Jan 28, 2018 at 19:22
  • Then better use VBA Code to customize your need ! Jan 29, 2018 at 7:58
  • Are you unable to copy the file and insert a header row into a temporary new excel file? Or does the read only apply to the file system as well as the original file?
    – datatoo
    Feb 1, 2018 at 0:34
  • Is there a way to script the copying and editing? Can copy to a new location to edit, but needs to be part of the automatic running of a scheduled script/batch file. Historically, I've run the query using dtexec from a *.BAT file...
    – Andrew
    Feb 2, 2018 at 0:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.