473,386 Members | 1,738 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,386 software developers and data experts.

Adding Excel Column Using C#

I have a situation where I am receiving an Excel spreadsheet from an external source. In this spreadsheet, the data contained in each row may be a duplicate of a previous row already processed. Even though the rows are duplicates, the data is still valid and must be treated as a separate entry. This data deals with financial data from multiple groups and I cannot get the sending party to insert any more data to make the rows unique.

Before anyone jumps on me about doing what I'm doing.... I realize this is not the ideal situation to import into a database because it is just basically emulating flat files with no primary key and no possibility of defining a unique index. However, the amount of data from these Excel spreadsheets is minimal and I need to be able store the data in a central place for archival and reporting purposes.

I want to be able to insert this data into a database and also determine if the row from the spreadsheet has been previously processed. Since I have no unique values to create a valid primary key, I was thinking of keeping track of rows processed in the spreadsheet.

I would like to be able to open the spreadsheet and determine if it contains a column called 'Processed'. If the column does not exist, I want to add the column to the spreadsheet and save it back to the server. If the column exists, then check the value to see if it contains a 'Y' indicating it has already been processed and move on to the next row. If the column is null (not processed), process the row and then update the 'Processed' column 'Y'. After processing all rows in the spreadsheet I want to be able to re-write the Excel spreadsheet back to the server.

I began coding using OLE DB methods to read and process the data and have some code already written but I did not have the complete picture of the data before I began. I would now like to prevent processing rows that have already been processed from being re-processed using the approach described above.

I am using Visual Studio .Net 2008 and C#. Also, this is a web application and the files are stored on the web server. Can anyone provide me with a preferred method of accomplishing the above and maybe a few code snippets? Any help would be greatly appreciated.
Thanks,
Jon
Apr 26 '10 #1
0 1358

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

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
9
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save...
3
by: Mansi | last post by:
I'm trying to use excel automation (from visual c# .NET) to fill data in a range by using arrays. I am using Microsoft's Knowledge Base Article 302096 as a reference and using the example listed...
5
by: Przemek Wrzesinski | last post by:
Hi, I'm trying to add additional column using 'alter table' command via OleDB to Excel workbook (one sheet called queExportBOND): Dim strConn As String strConn =...
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...
3
by: JohnM | last post by:
I can transfer from a query with DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Filenam", CPath, True I would like to use a form for the user to select and order data then...
1
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm...
1
by: rishiyo | last post by:
Good ones!! I want to retrieve and add datas with excel. I've tried one by adding two textboxes and two command buttons. THE code is: 'do declare these variables you need to add a reference'to...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
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...

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.