| Subject |
Re: importing csv file |
| From |
Gaetano D. <gaetanoddRemoveThis@andThatHotmail.com> |
| Date |
Wed, 30 Jun 2021 04:48:37 +1000 |
| Newsgroups |
dbase.getting-started |
On 30/06/2021 03:33, Mustansir Ghor wrote:
> Dear Mervyn Sir
>
> I read your below remark on date but could not figured the code to add. Will you help me on this.
>
> That code will work with most .csv files. If, however, you have to
> import dates you may need to add code to format the date before it gets
> saved to the .dbf file.
>
> Thank you sir
>
> Best Regards
> Mustansir
>
> Mervyn Bick Wrote:
>
>> On 2021/06/02 21:56, Mustansir Ghor wrote:
>>> Dear All
>>>
>>> Is there a way to import csv file into dbf table
>>>
>>> Best Regards to all
>>>
>>> Mustansir
>>>
>> Importdata.wfm in the dUFLP will do this. The form is, however, more
>> suited to once-off operations as it requires quite a bit of user input.
>> Where .csv files with the same layouts need to be imported into a
>> table regularly I find it easier to create a separate program to do the
>> work.
>>
>> If you look in the program I posted for you yesterday (nhif2.prg) you
>> will see that it did exactly that. The .csv file Excel made on my
>> computer used a semicolon as the separator. You would need to change
>> the ; to a comma in the breakstring parameter to deal with a comma
>> separated file.
>>
>> That code will work with most .csv files. If, however, you have to
>> import dates you may need to add code to format the date before it gets
>> saved to the .dbf file.
>>
>> Mervyn.
>>
>>
>>
Hi Mustansir,
Can you show us a sample record in CSV format so we can see what you are
working with in terms of date format and delimiters?
Replace sensitive/personal data with dummy data if needed, but leave the
format unchanged (date separators, field separators and field delimiters).
If the source date format is something like "2021-01-01", you will need
to remove the separators before you append the data. If your input is
format as "2021-01-01 09:00:00" as you might expect in an access control
system, then you need a timestamp field and the separator needs to be
removed too else it won't append or will append incorrectly.
--
Gaetano.
|
|