Запрос odbc в excel
While the data transfer tools provided by IBM can certainly retrieve data for use in Excel, they are not the easiest nor the most functional way to do that. Excel features a Data ribbon in which you can select different ways to import data into Excel. This technote demonstrates two different ways to retrieve data by using an ODBC data source (DSN) which was previously created and finally by using a DSN-less connection. In the following examples, Excel 2016 was used but the features exist in older versions of Excel as well.
Start by opening a blank worksheet and selecting the Data ribbon, then 'Get Data', 'From Other Sources' and select 'From ODBC' as shown in Fig. 1a
Select the data source to connect to Db2 on IBM i and expand the 'Advanced options' twistie and type in your select statement in the 'SQL statement (optional)' section as shown in Fig. 1b.
Click OK and it makes an ODBC connection, run the query and display the results in a table as shown in Fig. 1c
Press 'Load' and it loads the data into the spreadsheet and saves the query in it as shown in Fig. 1d
Note the 'Queries & Connections' item to the right of the data. If you hover your mouse over the spreadsheet icon just to the left of the query name (it was given a default name of Query1), you get a pop-up window as shown in Fig. 1e. The options in this window provide functions to edit the query and do several other things that are beyond the scope of this technote. Note, there is also a refresh icon to the right of the query name and clicking it refreshes the data in spreadsheet. If you close the 'Queries & Connections' pane, you can reopen it using the 'Queries & Connections' item on the Data ribbon.
Selecting the EDIT option opens the dialog box shown in Fig. 1f. With this dialog you can modify the query, change the query name, and use the 'Advanced Editor' function (near the upper left) to edit the SQL statement.
Connect Without A DSN
In the previous example, a DSN was selected to define the connection. A DSN or data source Name can be thought of as a saved collection of default values for an ODBC connection to use. Ultimately, the application might override most any of the values you specify in a DSN so they aren't strict controls on the settings. While DSNs are a great way to get consistent behavior from one or more applications, they do require the step of creating the DSN. You can freely share a spreadsheet with an embedded data connection defined in it (like our first example). But the recipient must also have that DSN defined with the same name (and connecting to the same system). So you can see how a DSN is also a hindrance to the portability of the solution. Fortunately, we can define the connection without a data source. Then, we can share the spreadsheet with anyone with the ODBC driver installed on their system. They can refresh that data as needed.
We follow the same steps of selecting the option to get data from ODBC. But this time, select '(None)' for the data source and enter a connection string that defines the ODBC driver to use and the system to connect to at a minimum. The ODBC connection string keywords and their default values are defined in the IBM Documentation. Using this interface, you do not need to provide values for anything more that the Driver and System keywords because we are not using any catalog features to browse for files or columns. If you have data in character fields defined with CCSID 65535, add the Translate keyword value pair. This value causes that data to be converted from EBCDIC by using the job CCSID so that's in the example in Fig. 2a.
You might be prompted for an ID and password after you press OK and then you are presented with the query results as in Fig. 1c from the first example. Select the option to load the data in the spreadsheet
Parameterized Query
Let's move on to something a little more dynamic. Frequently an entire table is transferred to a spreadsheet and then several rows are removed because they weren't wanted in the first place. In other words, a selection criteria set on the query ensures that only certain rows are selected and returned. The value for that criteria can be specified dynamically to provide a user with the flexibility to define the limiting values at run time. This next example shows how to create a parameterized query.
For this case, the accounting team is sending refund checks to customers with large credit balances. I need to find data for every customer that has a credit due to them that is greater than the limit that the accounting team set. Presently the limit is $10 so I really don't want to see the accounts that do not have more than a $10 credit due. I might change the query and add a hardcoded selection criteria, 'Where CDTDUE >= 10'. But the amount is known to vary from month to month and at the end of the fiscal year, anyone with a credit due is paid back. I don't want to edit the query every time it changes. I'd want the query to prompt me for a value when it is refreshed. To do accomplish this goal, we have to create the query a bit differently, by using Microsoft Query.
To start, open a new spreadsheet and select the Data ribbon, select 'Get Data', 'From Other Sources', 'From Microsoft Query'. That opens the dialog box shown in Fig. 3a. Select your DSN and clear the box for 'Use the Query Wizard to create and edit queries'.
In this case, it helps to have the library with the table you are querying in the library list of the DSN. That way you can select the schema (library) that the table is in, select the table and click 'Add' then 'Close' in the dialog box shown in Fig. 3b.
Double-click the asterisk to populate the query with all of the columns, or select the columns you want in the order you want them. See Fig. 3c.
Click 'Add Criteria. ' option on the 'Criteria' menu. Add the criteria for your query. In my case, I want to be prompted for a value that the CDTDUE column must be greater than or equal to. So I select the CDTDUE field, the proper comparison operator from the list, and an open and closed bracket for the value as shown in Fig. 3d.
Click add and it prompts for a value, type one in and then press 'Close' and then select 'Return Data to Microsoft Excel' from the 'File' menu. I am presented with the 'Import Data' window shown in Fig. 3e.
Press 'Properties' to decide how you want the parameter to be set. The 'Connection Properties' window opens. Check the ' Refresh data when opening the file ' option on the 'Usage' tab (Fig 3f). This setting causes a prompt for a new value every time the spreadsheet is opened. Then, select the 'Definition' tab, press 'Parameters' to open the 'Parameters' window shown in Fig. 3g.
Note, by default, it selected the value you entered when Microsoft Query prompted you for a value to initially run the query. I want the query to prompt the user for a value every time. So I select the first option for how the parameter is to be obtained, ' Prompt for value using the following string:' . I enter a meaningful prompt string that the user is presented with. Finally, click 'OK' on this window and the preceding two windows to embed your query into Excel. Excel prompts you for a value and then it populates your spreadsheet with the query data (See Fig. 3h).
Another Way To Enter Parameters - In The Spreadsheet Itself
OK that works great but there are a couple of potential problems. When that spreadsheet opens, it prompts for the minimum credit due value but it doesn't suggest a default. If someone new is using this spreadsheet, it would be nice to see what the last value used was. The other issue is that the minimum credit values required for a refund check change only at the end of my fiscal year and even then, only for one month. How can I keep the flexibility of the parameterized query but not have to enter a value every time? One way is to pull the value from a cell on the spreadsheet itself and refresh the data only when that that value is changed or when I click 'Refresh All' on the Data ribbon.
To start, open a new spreadsheet and create an input cell and a description of what is expected in that cell. Excel also has some default format colors you can apply to the cells to alert the user that a cell is an input value. See Fig. 4a for details.
Proceed as in the previous example and this time when you return the data to Excel, the target location is under the input area (see Fig. 4b) and click 'Properties' again.
Click the 'Definition' tab in the 'Connection Properties' dialog box and click the radio button titled 'Get the value from the following cell:'. Click the arrow button under that text (right side of the input field) then click your input field in the spreadsheet and Excel automatically adds the proper syntax to refer to the cell. In my example that would be =Sheet1!$B$1 meaning the value from Sheet1 of the workbook, Cell B1 (see Fig. 4c)
Click the 'OK' buttons to close these windows and embed the data into the spreadsheet as shown in Fig. 4c
This solution allows me to easily view what the parameter value is and I can update it and rerun the query by typing the new value into the input cell and pressing enter. At the end of the year, I put in the value 0.01 and press enter to get rows for everyone that has a credit due. (See Fig. 4e).
ПРИМЕНЯЕТСЯ К: 2013 2016 2019 Subscription Edition SharePoint Microsoft 365
С помощью Excel можно создать соединения OLE DB или ODBC, а затем совместно с другими использовать эти соединения. Соединения OLE DB или ODBC удобны для подключения к источникам данных, таким как книги Excel, унаследованные базы данных или базы данных не Майкрософт. Если в SharePoint Server 2013 можно загрузить подключение к данным в службы Excel, подключение к данным можно использовать для создания моделей данных, отчетов, показателей и панелей мониторинга. В зависимости от используемого источника данных люди могут легко обновлять данные в книгах Службы Excel, и таким образом отображаются наиболее актуальные сведения.
Подготовка
Перед выполнением этой задачи ознакомьтесь со следующими сведениями о необходимых компонентах.
Вы должны использовать Excel 2016 и SharePoint Server 2013.
службы Excel должна быть настроена на то, чтобы включить библиотеку надежных подключений к данным и библиотеку надежных документов. В идеале у вас должен быть настроен сайт центра бизнес-аналитики, который можно использовать для книг и подключений к данным. Дополнительные сведения см. в веб-сведениях Configure a Business Intelligence Center in SharePoint Server 2013.
Вы должны иметь по крайней мере разрешения на участие в SharePoint Server 2013.
Вам потребуется информация от администратора SharePoint о настройке проверки подлинности данных для баз данных, которые использует ваша организация. Это может влиять на способ подключения к разным источникам данных.
Вам потребуется информация об источнике данных, который вы хотите использовать. В частности, необходимо знать имя источника данных, имя пользователя и пароль для подключения к этому источнику данных.
Если вы планируете публиковать книги, содержащие модели данных для SharePoint Server 2013, службы Excel необходимо настроить для поддержки моделей данных. Дополнительные сведения см. в статье Configure Excel Services in SharePoint Server 2013 Preview.
Действие 1. Использование Excel для создания подключений к данным OLE DB или ODBC
С помощью Excel можно создать соединение OLE DB или ODBC. Это позволяет подключаться к множеству разных источников данных. В качестве примеров можно привести Microsoft SQL Server, Microsoft Access и базы данных Oracle, хотя существует множество других источников данных. Подключение к данным OLE DB или ODBC можно создать с помощью одного из следующих способов.
Можно создать подключение с помощью мастера подключения данных в Excel. (Это рекомендуемый способ.)
Можно создать подключение с помощью мастера запросов Microsoft Query в Excel.
Используйте следующие процедуры для создания подключений к данным OLE DB или ODBC.
Создание подключения с помощью мастера подключения к данным в Excel
В Excel на вкладке Data в группе Get External Data выберите из других источников и выберите мастер подключения к данным.
Откроется мастер подключения данных.
В каком источнике данных необходимо подключиться к списку? выберите источник данных и выберите Далее.
В зависимости от выбранного источника данных укажите сведения, необходимые для этого источника.
Указанная информация зависит от источника данных. Например, для источника данных "Веб-канал данных" требуется ссылка или адрес веб-канала данных и учетные данные для входа, а для источника данных "Книга Excel" требуется указать, где хранится эта книга. Дополнительные сведения о подключении, которое необходимо создать, обратитесь к администратору базы данных.
На странице Выбор базы данных и таблицы в списке Выберите базу данных, содержащую нужные сведения выберите базу данных, которую планируется использовать. Не выберите Далее.
На странице Выберите базу данных и таблицу выберите таблицу (или таблицы), которую вы хотите использовать, а затем выберите Далее.
На странице Сохраните файл подключения данных и завершите работу выполните следующие действия.
В поле Имя файла сохраните или измените имя файла по умолчанию.
В поле Описание введите краткое описание подключения к данным.
В поле Friendly Name сохраняем имя по умолчанию или введите новое имя для файла.
В поле Ключевые слова поиска введите некоторые слова или фразы, которые помогут пользователям найти подключение к данным при его публикации в SharePoint Server 2013.
Рядом с службы Excel выберите проверку подлинности Параметры. .
Выберите Нет, а затем выберите ОК.
Чтобы закрыть файл сохранения подключения к данным и закончить страницу, выберите Finish.
На странице Импорт данных выберите только создание подключения, а затем выберите ОК.
Повторяйте действия с 1 по 7, пока не создадите все нужные подключения к данным.
Если вы не можете создать подключение, которое необходимо с помощью мастера подключения к данным в Excel, вы можете попытаться создать подключение с помощью мастера запроса Майкрософт. Это удобно при подключении к старым базам данных. Однако созданное таким образом подключение может не поддерживаться в службах Службы Excel. Обратитесь к SharePoint администратору, чтобы убедиться, что создаемая связь поддерживается, чтобы люди могли обновлять данные в службы Excel файлах. Следующая процедура показывает, как создать подключение с помощью мастера запросов Microsoft Query.
Создание подключения с помощью мастера запроса Microsoft в Excel
В Excel на вкладке Data в группе Get External Data выберите из других источников, а затем выберите из Microsoft Query.
Отображается диалоговое окно Выбор источника данных.
Чтобы указать источник данных, который необходимо использовать, выберите вкладку Databases, Queries или OLAP Cubes.
Указанная информация зависит от источника данных. Например, если выбирается база данных Access или файл Excel, будет предложено перейти к базе данных или файлу на вашем компьютере. Если выбирается использование источника данных, отсутствующего в списке, будет предложено создать источник данных, а затем указать его тип, расположение и учетные данные для подключения к нему. Получите у администратора базы данных конкретные сведения в зависимости от подключения, которое вы хотите создать.
На странице Импорт данных выберите только создание подключения, а затем выберите ОК.
Повторяйте действия с 1 по 3, пока не создадите все нужные подключения к данным.
По умолчанию подключение к данным сохраняется в папке Мои источники данных библиотеки Документы на вашем компьютере.
Действие 2. Отправка подключений к данным в SharePoint Server
Если сайт центра бизнес-аналитики не используется, убедитесь, что используется библиотека подключений к данным, указанная как надежное расположение в службах Службы Excel. Дополнительные сведения см. в статье Управление надежными библиотеками подключения к данным служб Excel (SharePoint Server 2013).
Загрузка подключения к данным SharePoint Server
Откройте веб-браузер и перейдите на сайт SharePoint, содержащий библиотеку подключений к данным, которую планируется использовать.
Чтобы просмотреть списки и библиотеки, доступные для этого сайта, выберите содержимое сайта.
Чтобы открыть эту библиотеку, выберите подключение к данным.
Чтобы открыть диалоговое окно Добавить документ, выберите New Item.
Чтобы открыть диалоговое окно Выберите файл для Upload, выберите Просмотр.
Предполагая, что подключение к данным сохранено в его расположении по умолчанию, выберите Библиотеки, а затем выберите Документы, а затем дважды щелкните Мои источники данных.
Выберите ODC-файл, который необходимо загрузить, а затем откройте.
В диалоговом ок. Добавить документ выберите ОК.
Откроется форма Подключения к данным.
В форме Подключения к данным укажите следующие параметры.
В разделе Тип контента убедитесь, что установлен флажок Файл подключения к данным Office.
В поле Имя храните или измените имя файла ODC-файла.
В поле Название сохраните или измените имя ODC-файла.
В поле Описание введите описание подключения к данным.
В поле Ключевые слова введите одно или несколько слов или фраз. Эта информация используется поисковыми запросами для обнаружения подключения к данным.
Нажмите Сохранить.
Подключение к данным добавлено в библиотеку. Повторите эту процедуру для каждого подключения к данным, которое планируется использовать совместно.
Решение Майкрософт для работы с большими данными включает в себя компоненты бизнес-аналитики (БА) Майкрософт с кластерами Apache Hadoop, развернутыми в HDInsight. Примером может служить возможность подключения Excel к хранилищу данных Hive кластера Hadoop. Подключение с помощью драйвера Microsoft Hive Open Database Connectivity (ODBC).
Вы можете подключить данные, связанные с кластером HDInsight, из Excel с помощью надстройки Microsoft Power Query для Excel. Дополнительные сведения см. в статье Подключение Excel к HDInsight с помощью Power Query.
Предварительные требования
Перед началом работы с этой статьей необходимо иметь следующее:
- Кластер HDInsight Hadoop. Дополнительные сведения о создании кластера см. в статье Приступая к работе с Hadoop в HDInsight.
- Рабочая станция с Office 2010 Professional Plus или более поздней версии или Excel 2010 или более поздней версии.
Установка драйвера Microsoft Hive ODBC
Скачайте и установите драйвер Microsoft Hive ODBC. Выберите версию, которая соответствует версии приложения, где будет использоваться драйвер ODBC. В рамках данной статьи используется драйвер для Office Excel.
Создание источника данных Apache Hive ODBC
Ниже показано, как создать источник данных Hive ODBC.
В Windows откройте Пуск > Средства администрирования Windows > Источники данных ODBC (32-разрядная или 64-разрядная версия). В результате откроется окно Администратор источников данных ODBC.
На вкладке DSN пользователя выберите Добавить, чтобы открыть окно Создание нового источника данных.
Выберите Microsoft Hive ODBC Driver, а затем — Готово, чтобы открыть окно Microsoft Hive ODBC Driver DSN Setup (Настройка DSN Microsoft Hive ODBC Driver).
Введите или выберите следующие значения:
Необязательно: выберите Дополнительные параметры.
Параметр | Описание |
---|---|
Использовать исходный запрос | При выборе этого параметра драйвер ODBC НЕ пытается преобразовать TSQL в HiveQL. Следует использовать только при полной уверенности в отправке действительных инструкций HiveQL. При подключении к серверу SQL Server или базе данных Azure SQL необходимо снять этот флажок. |
Строки, загружаемые для каждого блока | При получении большого объема записей включение этого параметра может обеспечить оптимальную производительность. |
Длина столбца строки по умолчанию, длина столбца двоичного кода, масштаб столбца десятичных значений | Длина и точность типа данных может повлиять на способ выведения данных. Это приведет к возврату недопустимой информации из-за потери точности и/или усечения. |
Щелкните Тест для проверки источника данных. При правильной настройке источника результатом теста будет слово УСПЕШНО! .
Импорт данных в Excel из службы HDInsight
Ниже описан способ импорта данных из таблицы Hive в рабочую книгу Excel с помощью источника данных ODBC, созданного в предыдущем разделе.
Откройте новую или существующую рабочую книгу в Excel.
На вкладке Данные перейдите к разделу Получить данные>Из других источников>Из ODBC, чтобы открыть окно Из ODBC.
Из раскрывающегося списка выберите имя источника данных, который вы создали в предыдущем разделе, и нажмите ОК.
При первом использовании откроется диалоговое окно Драйвер ODBC. В меню слева выберите пункт Windows. Затем нажмите кнопку Подключиться, чтобы открыть окно Навигатор.
В окне Навигатор перейдите к HIVE>по умолчанию>hivesampletable, а затем нажмите кнопку Загрузить. Для импорта данных в Excel потребуется несколько секунд.
Дальнейшие действия
В рамках этой статьи вы узнали, как получить данные из службы HDInsight в Excel с помощью драйвера Microsoft Hive ODBC. Аналогичным образом можно получать данные из службы HDInsight в базу данных SQL. Можно также передавать данные в службу HDInsight. Дополнительные сведения см. на следующих ресурсах:
Connecting to SQL Server from Microsoft Excel using ODBC Driver for SQL Server
You can use Microsoft Excel to access data from a SQL Server database using ODBC connector. With ODBC Driver, you can import the data directly into an Excel Spreadsheet and present it as a table. Make sure that you use matching Excel and ODBC Driver, e.g. if you have installed a 64-bit ODBC Drive, you will need to use the 64-bit version of Excel.
When working with Microsoft Excel, there are different ways of retrieving data from various data sources using our ODBC drivers:
Connecting Excel to SQL Server with Get & Transform (Power Query)
You can use Get & Transform (Power Query) to connect to SQL Server from Excel with ODBC. This method assumes that you've installed an ODBC driver for SQL Server.
-
Click the Data in Excel, then expand the Get Data drop-down list. Click From Other Sources > From ODBC.
If your database is not password-protected or you've already specified your credentials in the ODBC data source settings, select Default or Custom and press Connect
The data from the table will be a displayed in an Excel spreadsheet where you can further work with it.
Connecting Excel to SQL Server with Data Connection Wizard (Legacy Wizard)
You can use this option to connect to OLE DB or ODBC external data source that has already been defined.
-
In Excel, go to the Data tab. Click From Other Sources, and then click From Data Connection Wizard.
In the opened dialog, select ODBC DSN and click Next to continue.
Now select a data source you want to connect to, and click Next.
To connect to the table containing the required data, select its name and click Next to enter and save information about your new file or click Finish.
In the Import data dialog, you can select the way your data will be viewed in Excel and the place where to put it in the worksheet, and click OK.
The required data is now displayed in the existing Excel worksheet.
Connecting Excel to SQL Server with the Query Wizard
You can use this option to create a simple query for retrieving data from SQL Server to Excel via ODBC driver.
-
Open Excel, in the main menu, click the Data tab.
Click the From Other Sources dropdown menu, and then click From Microsoft Query.
In the appeared dialog, you can choose the data source you want to connect to.
After a successful connection, you can select the data you want to be displayed in Excel and click Next.
The next two steps allow filtering and sorting the data. Click Next to skip these procedures.
If you plan to further use the query, you can save it by clicking the Save button on the right.
Select Return Data To Microsoft Excel and click Finish.
In the Import data dialog, you can select the way your data will be viewed in Excel and the place where to put it in the worksheet, and click OK.
The required data is successfully imported to Excel.
Connecting Excel to SQL Server with Microsoft Query
You can use this option to create a more complex query for retrieving SQL Server data to Excel via ODBC driver.
In the appeared ribbon, click From Other Sources, and then click From Microsoft Query.
In the next dialog, choose the data source you want to connect to (e.g., using data source name - Devart ODBC SQL Server). Uncheck Use the Query Wizard to Create/Edit Queries and click OK.
Now you can select the tables you want to add to your query. When you finish, just click the Add button.
In the graphical editor, you can filter rows or columns of data, sort data, join multiple tables, create a parameter query, etc.
Connecting Excel to SQL Server with PowerPivot
You can use PowerPivot - an Excel add-in to perform data analysis and create complex data models. To load the required data, do the following:
-
In Excel, click the PowerPivot tab, then click Manage to go to the PowerPivot window.
In the opened window, click From Other Sources.
When the Table Import Wizard opens, select Others (OLEDB/ODBC) and click Next.
In the Specify a Connection String window, click the Build button.
In the Data Link Properties dialog, specify the data source you want to connect (e.g., using data source name - Devart ODBC SQL Server), and then click Next.
Now you should choose how to import the data (either select a table from the list or write a query to specify the data to be imported).
When the Import operation succeeded, click the Close button. The retrieved data is inserted in the active worksheet.
With ODBC, you can summarise, and select just the data you need, in an Excel workbook before importing it into SQL Server. You can join data from different areas or worksheets. You can even get data from the result of a SQL Server SELECT statement into an Excel spreadsheet. Phil Factor shows how, and warns of some of the pitfalls.
Why Use ODBC?
It is reasonably easy to insert data from Excel into SQL Server, or the reverse, from any other ODBC database to any other, using PowerShell. The most important direction is from Excel to SQL Server, of course. It is quicker than automating Excel and you can do it without requiring a copy of Excel. It is neater than SSIS too, and more versatile. The most important thing, though, is that you can aggregate before you send the data. It is possible to do a lot of filtering and aggregation of data before it ever gets to SQL Server, since you can turn an existing Excel Workbook into a poor-man’s relational database, or even create one. This article will aim to show how this is done.
I always feel slightly awkward in talking about ODBC. It is a Once and Future technology, developed before its time, but now showing its value for processing large volumes of data, despite its quirks, poor documentation and lackluster support. If you use the ODBC driver, then your Excel workbook becomes a little SQL-based relational database. Worksheets, or areas within worksheets, become tables. There are some features missing, of course, but you can do joins between tables, filter rows to taste, do aggregations and some string manipulations. This means that you need pull far less data into SQL because you can do a lot of selection and pre-processing before the data gets anywhere near SQL server. If, for example, you only need the total, count, and variance of a day’s readings, then why on earth would you want to import more than those aggregated figures? Even if you do, these aggregations, performed on the original data, can be used as a ‘reconciliation’ check that you’ve gulped all the data into their final destination without error.
I also prefer to use ODBC and the sequential data reader to read data from Excel, or any other ODBC source, because it is fast; and I like to use the bulk copy library to insert ODBC ‘reader’ data into a SQL Server table because it is extremely fast, so we’ll use that. When you have a large number of big spreadsheets to insert as a chore, then speed matters.
The ODBC Excel driver (ACE)
ODBC was conceived as a way of making it as easy to connect to a particular datasource such a relational database, text file, data document (e.g. XML), web-based data or spreadsheet
Currently, the state of the art in ODBC for Access and Excel is the Microsoft Access Database Engine 2010 Redistributable which can be downloaded here. This includes the more popular OLEDB drivers which run well in PowerShell too. These drivers enable you to access a range of data files via SQL as if they were a relational database. Formats include Access, CSV, delimited, DBase and Excel
For developing on a general-purpose 64-bit desktop computer, you’re likely to hit a very silly Microsoft muddle. Microsoft recommends that you install the 32-bit version of Office 2010, even on 64-bit machines, since many of the common Office Add-ins did not run in the 64-bit Office environment. This advice has become baked-in ‘best practice’. If you are using 64-bit PowerShell, as most of us are, then you need to use the 64-bit version of the drivers. If you only have the 32-bit Office on your machine, then it will already have the 32-bit drivers, which won’t be visible to 64-bit PowerShell, and won’t work. You can’t install the 64 bit drivers when you already have the 32-bit drivers and I don’t think you can get anything good to happen by uninstalling the 32-bit drivers. Nope. All three (or four if you include Visual Studio) must be 64 bit. I gather that one way out of this Catch 22 is to first install the 64-bit Office 2010 ODBC/OleDB drivers and after that the (32-bit) Office, but there is a better fix that involves tweaking the registry. See this for the full frustrating story.
The ODBC Excel driver in ACE works with the latest Excel spreadsheet format up to 2010 as well as the old ones. I suspect that the latest version will work with Office 2013, though I haven’t yet tried it.
This driver is valuable because of the flexibility it gives. It actually executes ODBC SQL, which is a subset of SQL92, so you can put in column aliases, change the column order, and filter out rows that you don’t want to import. In effect, it presents you with a SQL tables which can be named ranges, if it is an existing worksheet that you’ve added named ranges to.
Читайте также: