We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Read CSV Truncates My Leading Zeroes

Home Forums Puzzles Read CSV Truncates My Leading Zeroes

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #75699
    takeoutprism
    Customer

    I am trying to increment and load a 6 digit reference number saved in a google sheet by incrementing with a webhook through Zapier and reading the sheet via csv. This all works great except the Read CSV puzzle is removing leading 0’s from my reference number, turning “000001” into “1” when reading csv data.

    How can I keep it from removing the leading zeroes?

    #75700
    xeon
    Customer

    sounds like its saving the value as a number rather than a text string.
    number: 0001, 0000001 all equals 1
    text: 0001, 00000001 and 1 are all different values.
    May want to check your variable types.

    Just a guess.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #75708
    takeoutprism
    Customer

    The value is text calculated from an integer value in cell A2 with the formula below. When the csv is viewed directly, the value displays properly with the leading zeros. The Read CSV puzzle seems to be converting the value.

    =TEXT(A2, "000000")

    #75710
    xeon
    Customer

    Ok…well.. good news and bad news.

    The “read CSV from” puzzle does truncate leading zeros. Thats a bug or should be a bug.

    BUT

    You can get around this by using a list puzzle and “load data” directly into the list. This will keep the leading zeros.

    See puzzles and console log attached.

    Attachments:
    You must be logged in to view attached files.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #75712
    kdv
    Participant

    Thats a bug or should be a bug.

    It’s not a bug. Numeric values with leading zeros don’t exist. In MS Excel try to type in 0001 and see the result ))) If you want those leading zeros you should read them as text values…

    =TEXT(A2, “000000”)

    change your formula to =TEXT(A2;"a000000") and after reading values from .csv just remove “a” from all values.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #75713
    xeon
    Customer

    Which goes back to the original statement….convert the numeric values to strings but its not necessary if you load the data into a list directly.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #75715
    kdv
    Participant

    but its not necessary if you load the data into a list directly.

    .csv files usually contain at least 2 columns (parameter;value;description;more). converting such files directly into a list has no sense.

    33_truss_4LRB;a00001
    counter;a00002
    Cube;a00001
    monkey.2d4f2c15;a00001
    oct_counter_1m;a00002
    set_25;a00001

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #75722
    kdv
    Participant

    converting such files directly into a list has no sense.

    but if needed, here’s a replacement for the “read CSV” puzzle: no numbers, string values only.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.