Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to read the excel cell and change it to bank if it is official banker.
So before that line, how can I read the cell with the control and change it to the word bank.

Bank Official change Bank.And Copy to database table Bank word.

How to read cell value and change?
Excel File

ID DEPARTMENT DEPARTMENTSHORTNAME


1 BANKER BANK

2 DOCTOR DOC

3 BANKER OFFICIAL BANKER OFFICIAL

4 BANKER OFFICIAL BANKER OFFICIAL

I want to database table is:

ID DEPARTMENT DEPARTMENTSHORTNAME

1 BANKER BANK

2 DOCTOR DOC

3 BANKER OFFICIAL BANK

4 BANKER OFFICIAL BANK

What I have tried:

Read Data from the Sheet.Use Open sql command and read excel file code.
Posted
Updated 3-Jul-19 9:32am
v3
Comments
ZurdoDev 1-Jul-19 14:01pm    
Where are you stuck?
Sinisa Hajnal 3-Jul-19 2:08am    
What is the problem with the code? Reading values from excel is well documented and replacements can be done through dictionary, either in code or in the database table. You can do replacements in the code or within stored procedure which inserts new data (just consult your short names table).

1 solution

Seems, you want to replace BANKER OFFICIAL with BANK.

I've already showed you up how to achieve that here: How do I read excel in C#?[^]

If you would like to get more information about how to read Excel files, please read the documentation! Start here: How to automate Microsoft Excel from Microsoft Visual C#.NET - Office | Microsoft Docs[^]
Automate Excel by using Visual C# to fill or to obtain data by using arrays - Office | Microsoft Docs[^]
Transfer data to an Excel workbook by using Visual C# 2005 or Visual C# .NET - Office | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900