I am trying to insert data and select data from Excel using an ODBC connection. I have managed to connect to it:
$dbh = new PDO("odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};Dbq=$file_name", $username, $password);
However, I am unsure how to query Excel as there is minimal documentation for this! I attempted this:
$query = "INSERT INTO $sheet ($cell) VALUES ($value)";
$result = $dbh->query($query);
But this leads to an error:
Array ( [0] => 07002 [1] => -3010 [2] => [Microsoft][ODBC Excel Driver] The Microsoft Office Access database engine could not find the object 'Sheet1'. Make sure the object exists and that you spell its name and the path name correctly. (SQLExecute[-3010] at ext\pdo_odbc\odbc_stmt.c:254) [3] => 07002 )
By object, hopefully they mean an excel sheet?
Thanks all for any help