I need to insert a row into an Excel spreadsheet using C#. I get a
reference to the app, the workbook, the sheet. When I attempt to call
Insert, I keep getting errors, probably because I'm not certain what the
args are (and cannot find any documentation to help). I supplied the 2 args
as I thought were correct ( Microsoft.Office.Inerop.Excel.XlDirection.xlUp,
row_num ), but these don't seem correct. Can anyone please help or point me
to a valid Web source?
TIA,
Tim 5 18100
Your argument Microsoft.Office.Inerop.Excel.XlDirection.xlUp,
row_num
Inerop -->Interop
"Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
news:Oa*************@TK2MSFTNGP10.phx.gbl... I need to insert a row into an Excel spreadsheet using C#. I get a reference to the app, the workbook, the sheet. When I attempt to call Insert, I keep getting errors, probably because I'm not certain what the args are (and cannot find any documentation to help). I supplied the 2 args as I thought were correct ( Microsoft.Office.Inerop.Excel.XlDirection.xlUp, row_num ), but these don't seem correct. Can anyone please help or point me to a valid Web source?
Can't you use ADO.NET with an Excel connection string instead? Then you just
use T-SQL INSERT statements :) http://www.c-sharpcorner.com/Code/20...essExcelDb.asp
Thanks. I'll give it a try.
By the way, in my code it reads "Interop"; I just mistyped it in my post.
Tim
"django" <la****@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com... Your argument Microsoft.Office.Inerop.Excel.XlDirection.xlUp, row_num
Inerop -->Interop
I still get the "Cannot shift objects off sheet" error. Any ideas?
Tim
"django" <la****@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com... Your argument Microsoft.Office.Inerop.Excel.XlDirection.xlUp, row_num
Inerop -->Interop
Yes, if he defines a range. You can also use adox to change the schema
without instantiating Excel. Office automation is evil.
--
Derek Davis dd******@gmail.com
"Danny Tuppeny" <gr****@dannytuppeny.commmmmm> wrote in message
news:43***********************@ptn-nntp-reader02.plus.net... "Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message news:Oa*************@TK2MSFTNGP10.phx.gbl...I need to insert a row into an Excel spreadsheet using C#. I get a reference to the app, the workbook, the sheet. When I attempt to call Insert, I keep getting errors, probably because I'm not certain what the args are (and cannot find any documentation to help). I supplied the 2 args as I thought were correct ( Microsoft.Office.Inerop.Excel.XlDirection.xlUp , row_num ), but these don't seem correct. Can anyone please help or point me to a valid Web source?
Can't you use ADO.NET with an Excel connection string instead? Then you just use T-SQL INSERT statements :)
http://www.c-sharpcorner.com/Code/20...essExcelDb.asp
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Vanessa |
last post by:
Hi
In my VB Dot Net program, I'm using Automation to call Excel worksheet to do
some insert some data.
I have rename my worksheet to a name. eg. "ABC".
How do I insert the worksheet name &...
|
by: Mansi |
last post by:
I'm trying to automate excel from c#. One of the things I need to do is to
copy/paste/insert rows in excel via c# code.
I tried to do the following:
1) Select a row in excel (a12 to k12)
2)...
|
by: Mamatha |
last post by:
Hi
When i clicked a button, i want to insert data from
listview in VB.NET to Excel sheet.
If you know the solution either above or below is ok for
me.
I know how to insert from a textfile,but...
|
by: creed1 |
last post by:
I am currently working with an Active Server Page (ASP) that is set to
redirect its output to Excel using Response.ContentType =
"application/vnd.ms-excel". It works great, but I need to find a...
|
by: kmercer46 |
last post by:
Unable to Shift Excel Colums to the Right.
Portion of my current VB .NET code is:
Dim oXL As Excel.Application
Dim oWBook As Excel.Workbook
Dim oWSheet As Excel.Worksheet
Dim oRng As...
|
by: accessvbanewbie |
last post by:
I would like to export a recordset from access to excel but after each record is exported I want to insert a new row.
The first recordset does this ok. However, the second recordset onwards does not...
|
by: JFKJr |
last post by:
Hello everyone, I am trying to insert a picture in an excel spreadsheet cell using Access VBA.
The following excel VBA code is working perfectly fine and I am able to insert picture in "A1" cell....
|
by: pexp |
last post by:
Hello All,
I would like to insert/update a database table using excel file.
I have a list of products in an excel file. If product exist in a database table tblproduct than it should update the...
|
by: premMS143 |
last post by:
I've created a application using VB.
Here, how to code to insert number of rows (user mentioned) in an existing excel worksheet ....?
In this, User has prompted,
1. Select an existing excel file...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |