Click here to Skip to main content
15,884,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi friends,

In my project i'm using excel data import concept.

in that i've import one excel named "Sheet1"..

if i imported the same excel again it should not be imported.
and
it should alert like "The Excel File Already Imported".


Is this possible??


Regards,
Venki
Posted
Comments
sudipta biswas 19-Jun-13 6:18am    
It is possible. The question is how you want to achieve it?
VIP Venkatesan 19-Jun-13 6:36am    
ya.. if possible means hw to achieve it...?

Read the import file, generate a hash of the file (SHA-256 etc.) store it.

If the next file has the same hash, then chances are you have already imported the file already.

As you have not really given much else to go on, this is the best option I can think of at the moment.
 
Share this answer
 
Comments
VIP Venkatesan 19-Jun-13 6:35am    
can u plz tell me more clear..
DaveAuld 19-Jun-13 7:40am    
How more clear can I be! Assuming you are uploading the file through an ASP.net website going by your tags. You upload the file, at the server you generate the hash, process the file. Upload the next file, process the hash. If the hash already exists, you have already processed that file.
VIP Venkatesan 19-Jun-13 7:47am    
actually i'm using SQLbulkcopy.. how can i generate hashcode during this process.. i've no idea about this.

if i'm using insert query means i can able to generate hash code and compare this with my existing table. but in SqlBulkcopy how it is possible?.

But i think that hash code will solve my problem.. Thank u. i need to generate hash code before using sqlBulkcopy. any possibility for this?
DaveAuld 20-Jun-13 2:21am    
Search for SHA-256 and you will find examples of hash generation. it is quite simple to do.
VIP Venkatesan 20-Jun-13 2:24am    
ok.. thank u
Hi,
Yes possible, in case you need to keep imported excel file along with sheet name in Database or any text file so every export you need compare with previous one.
 
Share this answer
 
Comments
VIP Venkatesan 19-Jun-13 7:56am    
if i'm using excel file "example.xls" and sheet name="Sheet1"
this excel file has values like "1","2","3"

now i'm using excel file "example.xls" and sheet name="Sheet1"
this excel file has values like "5","6","7"


so file name and sheet name is same. but the values are different. so by saving filename,sheetname we can't restrict the values. i think so..

apologize, if my assumption is wrong..
DaveAuld 20-Jun-13 2:12am    
Filename and sheetnames do not help. The cell values may be different. Use hashes to genenerate a digital fingerprint of the file/contents. store and compare them.

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