Re: Leading Zeros Stripped from Zips from CSV import in SSConvert



Don't use csv.  If you have N people discussing csv files,
you have N^2 opinions on how to handle csv files.

So don't use csv files.

Really.  If I change how they work, someone else is going to
be upset.

Now when I say that, people generally ignore me.  That's ok,
but I don't feel guilty when csv files bite them.

You can get what you want using the configurable text importer
and setting "Text" format for the column that has zip codes or
whatever.  That way the text will not be interpreted as a number.

Morten



On Fri, Feb 20, 2015 at 5:24 PM, Robert Huffman
<Robert thinkinspired com> wrote:
Thank you in advance for your help.

TLDR: When converting from CSV to XLS(X) with SSConvert, leading zeros on
zip codes get stripped.  ie: 08401 turns into 8401.

Detail:
I am working on a web application that uses PHP on the backend that allows
users to download data as CSV, XLS, or XLSX.  We use PHP to export the data
as CSV, then use SSConvert to convert the data to XLS(X).

This has been generally working alright for us (minus some bumps that we
have overcome).  However, we have now hit a snag.

When we try to convert zip codes with a leading zero (or more than one, such
as 00501) the leading zeros get stripped away, which can present major pain
when working with the data later.

Now, I know this isn't an excel display issue because I opened up the
resulting xlsx as a zip, then looked at the xml file for the data, and found
the leading zero stripped there too.  Additionally, I tried converting from
csv -> csv, and the zeros were stripped there too.

I tried using the both "Gnumeric_Excel:xlsx" and "Gnumeric_Excel:xlsx2" for
export, and have been using "Gnumeric_stf:stf_csvtab" for import.

I tried using "Gnumeric_stf:stf_assistant" because "Text import
(configurable)" sounded like it might be what I wanted. But it didn't seem
to want to convert (or throw an error), and I couldn't find any
documentation on how I would configure it's import.

I tried refreshing my C skills by pulling down the repo from Github in the
hopes I could use the source code for inspiration.  Instead, it reminded me
how rusty I am with C, and how unfamiliar I am with the code base.  I
managed to see some undocumented command line args, that really don't help
me right now.

Any help would be appreciated.  Thank you!

_______________________________________________
gnumeric-list mailing list
gnumeric-list gnome org
https://mail.gnome.org/mailman/listinfo/gnumeric-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]