Topic: Need help with excel import

Dear All

I need help with importing excel files when I import a file the MVD duplicates the First name and last name, I need the program to update the information not insert a new row, any one can help me with this, please.

Attached the program with CVS file

Post's attachments

Attachment icon dose11.rar 299.97 kb, 197 downloads since 2021-10-24 

Re: Need help with excel import

Hi Alaa,
.
From my experience, it's not possible to UPDATE existing data from a simple CSV import.  It will only add to the existing data like you observe.  I usually clear the table prior to importing.
.
I think it would require some scripting for it to prevent duplication, but sorry I haven't done this before.

"Energy and persistence conquer all things."

3 (edited by sparrow 2021-10-25 08:23:03)

Re: Need help with excel import

Hi

This is an example in your program of how you can do this through a script. DriveSoft code from the Russian forum thread http://myvisualdatabase.com/forum/viewtopic.php?id=1373
On Form1 there is a button for import.
There are notes in the script.
Since the fields in the CSV file and the database table are different, I left the fields FIRST NAME, LAST NAME. Add the rest as needed.

Post's attachments

Attachment icon dose-imp.zip 347.27 kb, 211 downloads since 2021-10-25 

Re: Need help with excel import

thank you all for supporting it was great, I will try it.

I have a second question. can I Paste the data for one row instead of importing it?

Re: Need help with excel import

Alaa wrote:

thank you all for supporting it was great, I will try it.

I have a second question. can I Paste the data for one row instead of importing it?

This is a very general question.
What to copy? Where to paste?
How do you see it?

Re: Need help with excel import

thank you for your reply.
I need a copy from excel and paste it in the table grid direct for more than one cell in one row.

Re: Need help with excel import

As DriveSoft said in one of the answers:
"You should not to use TableGrid for import data ..."

Re: Need help with excel import

Sorry sir
So I can't do copy, paste, i need to read data from an external source such as a reading device and this device get me many result "cell in excel" so I want to save it on table grid. how I can do that automatically without manual input "one by one.

Re: Need help with excel import

Alaa,
What you want to do can be done but it needs to be done through script. The standard import feature in MVD only does inserts, but you want to do updates for existing rows based on first name and last name, correct?


I will try to put something together for you in the next day or two. I'm extremely busy right now with my own projects.

Re: Need help with excel import

Thank you ehwagner.

yes, I want to update existing data based on first and last names.

Thanks again I am Waiting for your helping.

Re: Need help with excel import

Alaa,
I put together a script to import into your participants. It does two things. If a database record with identical first and last names as the import file then the process will update the database record. If no first name or last name exists in the database then the record is inserted into the database. One thing to be careful with. If you have duplicate participants with the same name then the update process will update all the records having the same name. You need to make sure that your table maintains unique records. You might want to include another field in the duplicate check besides the name. Anyway, the attached should at least get you started in the right direction.

Post's attachments

Attachment icon dose revised.zip 353.99 kb, 241 downloads since 2021-11-01 

Re: Need help with excel import

Hi all,

I had same issue and solved it by creating 2 tables in database, one called DATA and other called IMPORT
So I made it to import into IMPORT table and then update data in DATA table, after process is done, drop IMPORT table

Of course, added duplicate check
Also added select file, read column name and import to corresponding field so no matter where is column "First Name" it goes to field "First_name"

That is easiest you can do

Re: Need help with excel import

can you please upload your project in order so I can see it, or if you can edit my project because i cant find who it will work?

Re: Need help with excel import

Alaa,
Look in my previous post. The project is attached there.