Page 1 of 1

converting csv to csdb in the server

Posted: December 7th, 2024, 7:08 am
by AriSilva
Hi folks,
I´m receiving a csv file stored in the server, and I need to convert it to a csdb file, in the server.
What I´m trying to do now is a little bit ackward, in four steps, such as:
1. syncfile with a GET to download the csv file.
2. an excel macro to read the csv and convert it to a xlsx file
3. the excel to cspro utility, converting the xlsx file to csdb
4. syncfile with a PUT to upload the csdb file

Is there a more direct way to execute that?
Another question: Is ther a way to delete (or clean) a csdb file in the server, like using a clear parameter in the syncdata command, or something like that? In other words, how can I start fresh a csdb file in the server, using the cspro language, instead of having to go to the server by hand, delete the csdd file, and then create a new dictionary again?
Best
Ari

Re: converting csv to csdb in the server

Posted: December 9th, 2024, 12:19 pm
by justinlakier
Hello,

That four-step process is correct. The steps can be automated to be faster, but not meaningfully made more direct, since it will be 2 steps for upload/download and 2 steps to indirectly convert a .csv to a .csdb.

For clearing the data of a csdb, there is no way to delete files on the server. SyncFile can replace a file with a newer version, so you could use this to replace a file with a "clean" one, although SyncFile is meant for non-data files. CSPro language is not made with deleting server data from user devices in mind.

Hope this helps,
Justin

Re: converting csv to csdb in the server

Posted: December 10th, 2024, 11:23 am
by AriSilva
Thanks, Justin,
I´ll try another approach with the data provider. Instead of a csv, I´ll ask for a fixed width text format, and work directly with that file in the server, without converting it to a csdb.
Best