Page 1 of 1

Excel

Posted: Mon Jan 18, 2021 12:58 pm
by omni
Roger,
An odd request.

We have a user whose holding company wants file contents every night sent to them on a half dozen file. We sent via csv (with just copying/renaming dbf file) and they said it was ok, but looked like an xls, which it would. We renamed them to xls. Then they said they needed it to be a real csv.
We then copied using a copy to... delimited. (used that for 20+ years for csv)
Now they do not want quotes. Never heard of that even being an option on any export, unless you manually do it field by field with a comma in between. And somehow handle the fields with commas.
(which I will not offer and it would cost them a fortune in hourly work)

Anybody have any thoughts..other than to tell them to go jump....

Thanks
Fred Omni

Re: Excel

Posted: Tue Jan 19, 2021 12:42 am
by Tom
Hi, Fred.

There is no definition for sequential files containing "comma separated values" or "character separated values", what "CSV" stands for. There is something like a definition in RFC 4180 (https://tools.ietf.org/html/rfc4180), but different to other formats, there is no standard. The separation character can be a comma or a semicolon (or maybe a plus sign), values can be quoted or not (or mixed!), the decimal sign can be a comma or a point, there is no standard character set (ANSI, OEM, UTF-8, UTF-16, whatever) that's f*cking life. We created input- and output-routines handling that, controlled by user-input. It's not a really big problem to especially write output-routines with various options. If textes are not quoted, just remove the separation character from them, or translate it to a different character (or show a warning).

As a very good programmer said to me years ago: Think of the future! If you create a function, class or so, just think of way may happen in the future to the programs using those functions. If you design them in a way which gives maximum flexibility and comfort, you don't get that kind of problems if users show up and ask for improvements.

Re: Excel

Posted: Tue Jan 19, 2021 12:47 am
by Auge_Ohr
hi,

what do they want to have : CSV to import or "ready" XLSx :?:

i guess they want a XLSx and ask for CSV while your "Trick" does not work with newer Excel Version.
DBF Converter is default NOT installed so DBF is a "unkown" Format.

---

if they real want CSV i recommend to use FCREATE() / FWRITE() instead of xBase Command ...

Re: Excel

Posted: Tue Jan 19, 2021 1:06 am
by Tom
Don't forget, you have "DC_WorkArea2CSV()" and "DC_Array2CSV()" in eXpress++, so maybe you don't need to write or create anything. Just look at the docs.

Re: Excel

Posted: Tue Jan 19, 2021 3:45 am
by Victorio
I saw one solution, how realise universal system for CSV file, this is not simple CSF file, but principe is :
txt file has header where is definition of used delimiter,
program read this and then use it for delimiting.
nice is that this delimiter can be changed also inside CSV file, for example when delimiter is semicolon, and I need use semicolon in some text string, I can change delimiter to hash and
row is processed correctly.
So it is not universal system, need own function to read it, cannot direct load to Excel.
I mean semicolon is better delimiter than comma, because text string often have some comma

Re: Excel

Posted: Tue Jan 19, 2021 9:07 am
by Eugene Lutsenko
All this is true. There doesn't seem to be a single simple standard for CSV files. But oddly enough, there are online services that work well with all the variety of blurry CSV file standards.

https://convertio.co/ru/csv-xls/
https://onlineconvertfree.com/ru/conver ... sv-to-xls/