473,289 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Issue when reading data from excel sheet

ammoos
100 100+
Hi Friends

I am getting the following error when I am trying to read data from an excel sheet using sql script

OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the error.].


If I save the excel file in the database server machine, then it will work fine.. I am getting this error message when I save the excel file in any other machine in the network and trying to read data from that excel sheet

I am using the following code

Select @PowerFileName = '\\xxx.xxx.x.xxx\upload\Data_Sheet.xls'
EXEC MASTER..XP_CMDSHELL @cmd, NO_OUTPUT
set @provider = 'Microsoft.Jet.OLEDB.4.0'
set @ExcelString = 'Excel 5.0;Database=' + @PowerFileName
EXEC ('select * into tbl_BaseLoad from OPENrowset(''' + @provider + ''',''' + @ExcelString + ''',''SELECT * FROM [baseload$] WHERE F3 IS NOT NULL UNION SELECT * FROM [baseload$] WHERE F2='+ @CurrentDateNumber +''')')


Please help me

Ammooss
Jun 26 '09 #1
8 3366
ck9663
2,878 Expert 2GB
Can you access that machine from the SQL Server?

-- CK
Jun 26 '09 #2
ammoos
100 100+
Yes.. I can access that machine from sql server machine
Jun 29 '09 #3
ck9663
2,878 Expert 2GB
How do you access the remote machine?

-- CK
Jun 30 '09 #4
ammoos
100 100+
Sorry..I couldnt understand your question.. I access the remote machine using the IP via the Run
Jun 30 '09 #5
ck9663
2,878 Expert 2GB
I mean accessing inside the SQL Server. The RUN command is on the OS level, not inside SQL Server. Have you tried accessing the remote machine from SQL Server via IP?

--- CK
Jun 30 '09 #6
ammoos
100 100+
CK

I am not sure how to access the remote machine from SQL Server via IP.. Can you pls help me?

Ammooss
Jul 1 '09 #7
ammoos
100 100+
CK

I just tried to copy the same excel file from remote machine to the server machine using the following code.. but that time I got the message "Access is denied"

declare @msg varchar(3000)
declare @file varchar(1000)
declare @file1 varchar(1000)

set @file = '\\remote macine IP\folder\Data_Sheet.xls'
set @file1 = '\\server machine IP\folder\Data_Sheet1.xls'

SET @msg = 'copy "' + @file + '" "' + @file1 + '"';

exec master.dbo.xp_cmdshell @msg

but this code works fine if I try to copy a file from one folder in the server machine to another folder

Ammooss
Jul 1 '09 #8
ck9663
2,878 Expert 2GB
Here, read this first.

Good luck!

--- CK
Jul 1 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
3
by: Mads Petersen | last post by:
I'm stuck in this code. Hope you can and will help me. I launch it from excel. I have made the following code work, but not as i whant. I need the ranges to be working with something like xlDown....
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
4
by: preetinair033 | last post by:
Hi All, I have written a program to write the data into excel file (for eg: file.xls). This writes the data into the active sheet, ie, the sheet1. However I wish to write and read data from an...
1
by: =?Utf-8?B?ZmhpbGxpcG8=?= | last post by:
We have a code snippet that downloads data to Excel. it is writing row by row. This causes a performance issue. Any ideas on how to speed this up will be appreciated. Please find below an...
1
by: =?Utf-8?B?QWRyaWFuTW9ycmlz?= | last post by:
Hello All, I am trying to read an Excel spreadsheet (xls) programmatically. I have used the ODBC database route and have opened the Excel spreadsheet and then using a 'CRecordset', I read each...
1
by: vtangella | last post by:
Hi Guys! Here i am using Apache POI for reading the Excel sheet in java and then i am capturing the excel sheet data into a ArrayList and then i am storing it in DB. Any Other way to store...
4
ammoos
by: ammoos | last post by:
Hi Friends, I need to read data from an excel sheet. I am keeping this excel sheet in a remote machine. I am using OLEDB connection to read the data from this excel sheet. But when I am trying to...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.