OLE DB Verbindungen zu Excel: Unterschied zwischen den Versionen
JF (Diskussion | Beiträge) (→Einschränkungen) |
GK (Diskussion | Beiträge) (→Einschränkungen) |
||
Zeile 110: | Zeile 110: | ||
|} | |} | ||
− | ==Einschränkungen== | + | == Einschränkungen == |
− | + | * Da die SQL-Befehle <code>DELETE</code> (Datensatz löschen) und <code>DROP</code> (Tabelle löschen) nicht unterstützt werden, wird der Wert der Eigenschaft [Tabelle vor Export leeren] ignoriert. | |
− | + | * Die SQL-Befehle <code>COMMIT</code> und <code>ROLLBACK</code> werden nicht unterstützt. | |
− | |||
{| | {| | ||
|- valign="top" | |- valign="top" | ||
Zeile 129: | Zeile 128: | ||
|} | |} | ||
|- | |- | ||
− | |}< | + | Also, if a name is too long, an error will occur. |
− | + | |- | |
+ | |} | ||
+ | * Scan the connected data and determine the value type. | ||
+ | * When scanning the data to determine value types, the default is to check up to 8 rows. | ||
+ | The most common value type is used after scanning the rows.<br>The MAXSCANROWS attribute can be added to the Extended Property settings to alter this behavior. | ||
+ | A number of rows to scan from 1-16 can be specified. | ||
+ | * If nothing is specified, the TypeGuessRows value of the registry key | ||
+ | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel | ||
+ | will be used as the number of rows to scan. The default value for this is 8. | ||
+ | |||
+ | By setting a value between | ||
+ | 0 - 16 | ||
+ | in this registry key, the behavior can be controlled without the MAXSCANROWS attribute. Setting a value as zero will cause all rows to be scanned. | ||
+ | |||
+ | * When data type is mixed and there is "IMEX=1" in the "Extended Properties" of connection string in import mode. This mode can be made unavailable, if the registry key "ImportMixedTypes=Text" is set forcibly. Update data in this mode, the results will be unexpected. | ||
+ | |||
+ | The value of ImportMixedTypes registry key | ||
+ | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel | ||
+ | |||
+ | * Connecting to Excel files with passwords set is not supported. | ||
+ | * Excel worksheets and named areas can be connected. | ||
+ | Sheets will have a dollar sign after their name, whereas named areas do not. | ||
+ | It is possible to connect to multiple named areas within one sheet. | ||
+ | |||
+ | For named areas, the entire area will be imported (even when no data is contained). This means it is possible to import empty rows. To avoid importing empty rows, set | ||
+ | FValid(ME.Code) | ||
+ | in the Import external filter expression. | ||
+ | |||
+ | Moreover, because of the tail information of the output rows, so far, is available in Excel, this information is exported so that the rows are added. | ||
+ | |||
+ | * COMMIT and ROLLBACK commands are not supported. | ||
+ | |||
+ | == Connection with [*.xlsx] file (Excel 2007) == | ||
+ | |||
+ | -Specify the OLE DB provider as "Microsoft Office 12.0 Access Databese Engine OLE DB Provider". | ||
+ | |||
+ | -The path of related registry path is as follows. | ||
+ | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Access Connectivity Engine\Engines\Excel | ||
<hr> | <hr> | ||
<div align="right">Hilfe Nummer: 757700</div> | <div align="right">Hilfe Nummer: 757700</div> |
Version vom 8. Juli 2019, 13:31 Uhr
Inhaltsverzeichnis
Arbeitsschritte
Die Verwendung der Option OLE-DB für Datenimport- und -exporteinstellungen ermöglicht zum Datenaustausch mit Excel.
Datenquelle
Setzen Sie in den Schnittstelleneinstellungen für das Schnittstellenobjekt "OLE DB" als [Datenquelle].
Provider
Wählen Sie im über [Verzeichnis/Datenbank] geöffneten Dialogfenster "Microsoft Office xx.0 Access Database Engine OLE DB Provider" aus und klicken dann auf [Weiter >>].
Dateipfad
Datenquelle: Geben Sie nun Pfad und Dateinamen der Excel-Datei ein, zu der Sie eine Verbindung erstellen möchten.
Erweiterte Eigenschaften
Legen Sie nun unter dem Reiter [Alle] die Version der Excel-Datei im Feld [Extended Properties] fest.
So wie in der Excel-Version können auch weitere Attribute im Feld [Extended Properties] eingegeben werden:
Wert | Bedeutung |
---|---|
HDR | Definiert ob die erste Zeile Spaltenköpfe oder Daten enthält. |
Yes | Daten der erste Reihe, die im Excel-Tabellenblatt Werte enthält, werden als Spaltenköpfe interpretiert. Leeren Zellen in dieser Zeile werden automatisch generierte Feldnamen "F1", "F2", etc. zugewiesen. |
Nein | Feldnamen werden automatisch erstellt, beginnend mit "F1", "F2", etc. |
MAXSCANROWS | Bestimmt automatisch den Datentyp der Daten in Excel. Legen Sie die Anzahl der zu prüfenden Zeilen (von 1 - 16) fest. Standardmäßig werden die ersten acht Zeichen für die Bestimmung betrachtet. Nachdem alle Zeilen geprüft wurden, wird der jeweils häufigste Datentyp ausgewählt. Ist MAXSCANROWS nicht definiert, wird [TypeGuessRows] des Registry-Schlüssels HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine\Engines\Excel verwendet, um die Anzahl der zu prüfenden Zeilen zu bestimmen. Der Standardwert beträgt hier 8. Wird 0 eingegeben, werden alle Zeilen überprüft.
|
Für eine Excel 2016 Datei mit Spaltenköpfen würde der folgende String als Wert für [Extended Properties] genutzt:
Excel 12.0;HDR=Yes
Externe Tabelle
Wurden diese Einstellungen vorgenommen und eine Verbindung zu Excel hergestellt, so kann das zu verwendende Tabellenblatt auf die herkömmliche Weise in der Eigenschaft [Externer Tabellenname] des DBIO-Objekts ausgewählt werden. Neben Tabellenblättern können auch benannte Zellbereiche als externe Tabelle dienen. Tabellenblattnamen enthalten ein Dollarzeichen am Ende ihres Namens (z.B. "Tabelle1$"), Zellbereiche aber nicht.
Innerhalb eines Tabellenblattes können Verbindungen zu mehreren benannten Zellbereichen hergestellt werden. Zellbereiche werden komplett importiert, selbst wenn keine Daten enthalten sind. Es kann also sein, dass leere Zeilen importiert werden. Um dies zu vermeiden, kann FValid(ME.Code)
als [Externe Importfilterformel] gesetzt werden.
Weitere Einstellungen
Die weiteren Einstellungen ([Field-Mapping] etc.) entsprechen denen anderer OLE DB-Verbindungen.
Spaltenköpfe
Abhängig von [Extended Properties], können in Excel-Dateien Spaltenköpfe verwendet werden.
Mit Spaltenköpfen
HDR=Yes
- In der Excel-Datei werden Spaltenköpfe erwartet. Die erste Zeile mit Daten wird als Spaltenköpfe interpretiert.
Excel-Datei | [Field-Mapping] |
---|---|
1. Leere Zeilen werden übersprungen 2. Diese Zeile wird für die Spaltenköpfe genutzt |
Leeren Zellen in der Spaltenkopfzeile werden automatisch generierte Feldnamen "F1", "F2", etc. zugewiesen.
Excel-Datei | [Field-Mapping] |
---|---|
Feldname für leere Zelle wird automatisch gesetzt |
Ohne Spaltenköpfe
HDR=No
- In der Excel-Datei werden keine Spaltenköpfe erwartet. Die erste Spalte mit Daten wird als das erste Datenfeld interpretiert, bis zur letzten Spalte mit darin enthaltenen Daten. Feldnamen werden automatisch erstellt, beginnend mit "F1", "F2", etc.
Excel-Datei | [Field-Mapping] |
---|---|
Da keine Spaltenköpfe erwartet werden, werden Feldnamen automatisch erstellt. |
Einschränkungen
- Da die SQL-Befehle
DELETE
(Datensatz löschen) undDROP
(Tabelle löschen) nicht unterstützt werden, wird der Wert der Eigenschaft [Tabelle vor Export leeren] ignoriert. - Die SQL-Befehle
COMMIT
undROLLBACK
werden nicht unterstützt.
Während eines Exports, bei dem Daten hinzugefügt werden, werden die neuen Daten immer ans Ende von bestehenden Daten gesetzt. Dabei können Fehler auftreten, wenn durch die hinzugefügten Zeilen die maximale Anzahl an Zeilen in Excel überschritten wird. |
|
- Scan the connected data and determine the value type.
- When scanning the data to determine value types, the default is to check up to 8 rows.
The most common value type is used after scanning the rows.
The MAXSCANROWS attribute can be added to the Extended Property settings to alter this behavior.
A number of rows to scan from 1-16 can be specified.
- If nothing is specified, the TypeGuessRows value of the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel will be used as the number of rows to scan. The default value for this is 8.
By setting a value between 0 - 16 in this registry key, the behavior can be controlled without the MAXSCANROWS attribute. Setting a value as zero will cause all rows to be scanned.
- When data type is mixed and there is "IMEX=1" in the "Extended Properties" of connection string in import mode. This mode can be made unavailable, if the registry key "ImportMixedTypes=Text" is set forcibly. Update data in this mode, the results will be unexpected.
The value of ImportMixedTypes registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel
- Connecting to Excel files with passwords set is not supported.
- Excel worksheets and named areas can be connected.
Sheets will have a dollar sign after their name, whereas named areas do not. It is possible to connect to multiple named areas within one sheet.
For named areas, the entire area will be imported (even when no data is contained). This means it is possible to import empty rows. To avoid importing empty rows, set FValid(ME.Code) in the Import external filter expression.
Moreover, because of the tail information of the output rows, so far, is available in Excel, this information is exported so that the rows are added.
- COMMIT and ROLLBACK commands are not supported.
Connection with [*.xlsx] file (Excel 2007)
-Specify the OLE DB provider as "Microsoft Office 12.0 Access Databese Engine OLE DB Provider".
-The path of related registry path is as follows. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Access Connectivity Engine\Engines\Excel