473,473 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Manipulating Excel

using Excel;

Excel.Application ExcelApp = new Excel.ApplicationClass();
string workbookPath = Server.MapPath("excel\\produto1.xls");
Excel.Workbook excelWorkbook = ExcelApp.Workbooks.Open(workbookPath,
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
string currentSheet = "Plan1";
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item(currentSheet );
Im using the code above, but how can I loop through all the columns and rows
of the sheet? Can you help me?

Using VS 2005 asp.net 2.0 C#

Thanks!
Sep 28 '07 #1
2 2027
"Paulo" <pr*****@uol.com.brwrote in message
news:ut**************@TK2MSFTNGP02.phx.gbl...
Excel.Application ExcelApp = new Excel.ApplicationClass();
Im using the code above, but how can I loop through all the columns and
rows of the sheet?
You can't.

Excel, like the rest of Office, is not designed to run via server-side
Office automation - Microsoft won't support any solution which even attempts
this, because it doesn't work:
http://support.microsoft.com/default...US;q257757#kb2

To meet your requirements, you need this:
http://www.aspose.com/Products/Aspos...s/Default.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 28 '07 #2

You can use a System.Data.OleDb.OleDbConnection and get an IDataReader
against the Excel spreadsheet.
http://support.microsoft.com/kb/316934
It would be best to avoid the excel object model, and as pointed out
already, is a really bad idea server side.


"Paulo" <pr*****@uol.com.brwrote in message
news:ut**************@TK2MSFTNGP02.phx.gbl...
using Excel;

Excel.Application ExcelApp = new Excel.ApplicationClass();
string workbookPath = Server.MapPath("excel\\produto1.xls");
Excel.Workbook excelWorkbook = ExcelApp.Workbooks.Open(workbookPath,
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
string currentSheet = "Plan1";
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item(currentSheet );
Im using the code above, but how can I loop through all the columns and
rows of the sheet? Can you help me?

Using VS 2005 asp.net 2.0 C#

Thanks!

Sep 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: caroundw5h | last post by:
I would like to manipulate my excel file as if it were a text file with python (check for duplicates, uppercase etc.). I would like to know: 1) how do convert it first to a CSV file and...
6
by: Jim | last post by:
I have a Web application that needs to update a Microsoft Excel spreadsheet for complex calculations, whereby I read the results into a dataset for display. I am accessing my spreadsheet using OLE...
1
by: Robin Tucker | last post by:
Heres and interesting problem: I have a VB.NET program that creates reports via. Word Automation. This all works fine. What I want to do as part of this report generation process is to embed a...
2
by: E-Cube | last post by:
I am able to write to an existing excel file with data. I am wondering how do I outline my rows while in I am writing data to the excel file while in code? Thank you for any help that you may...
1
by: xavierrangel | last post by:
hey guys I'm trying to change the backcolor of a cell in excel using vb6.0 . at first I changed the size like this obj1.Columns(3).ColumnWidth = 15 but now I need to change the color thanks...
4
by: spirit | last post by:
Hi, I have C++ code to write data to a .csv file thereby resulting in an excel spreadsheet. I was just wondering whether it wud be possible for us to further manipulate the csv file like for...
0
by: Ed from AZ | last post by:
I'm using Word 2003. I use a proprietary Java program that takes all the information in the various forms and generates an XML file. There are times I need to move information between files. I...
0
by: Tzesho | last post by:
A director of my company insists on using an Excel database to store his data. I have been tasked to come up with a new GUI in .NET C# that accesses and manipulates the data in his Excel database. ...
2
by: danny2000 | last post by:
Hi all. Please excuse my ignorance here, but is it possible and / or efficient to do things such as insert worksheets, make charts, pivot tables, filter data in an excel workbook using Perl? ...
0
marktang
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,...
0
jinu1996
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...
1
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...
0
tracyyun
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...
0
agi2029
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.