Bug: CSV import results in wrong column type

J. Craig Williams
J. Craig Williams ✭✭✭✭✭✭
edited 12/09/19 inSmartsheet Basics

When I import a csv file with a numeric column but more than half of the data is 0 or 1's, the column becomes a CheckBox column.

Less than half and it is (accurately) a Text/Number column.

Either the threshold should be much lower, or any non-Boolean number should force the column type to be Text/Number, or the user should be able to select the column type during import

I have submitted to support with three csv files.

Craig Williams

the_csv_file.png

the_results.png

Comments

  • Hi Craig—

    Not necessarily sure if this is a bug or not. It could be automatic logic that we perform on purpose to try and guess at the column types that you need without causing data corruption or misinterpretation on import.

    Question: what are the drawbacks to changing the column type after import vs having an option to select the column type during import?

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭

    Changing column type from CheckBox to Text/Number results in

    true, false

    Not 1,0

    If there are 49% numbers that are > 1 and 51% that are 0,1 that's pretty clear to me. 50% is arbitrary.

    Craig

  • I am having the same problem.

    Is there a fix or workaround for this issue?

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭

    Work-around #1:

    In my specific case, I opened the csv file in an editor and replaced

    ,1^p

    with

    ,ONE^p

    and then imported. I then searched and replaced ONE with 1

    (you need an editor the understands regex - my offending column happened to be in the last column)

    方法# 2:

    If it hadn't been, I would have written a quick awk script (a one liner) to replace 1's in the offending column.

    As in most things of this nature, it depends on the data.

    Craig

  • My workaround:

    Import .csv as is

    Change column type from checkbox to text/number

    Highlight the column

    Ctrl+ F to replace "false" with "0", "", or null (your preference)

    Repeat to replace "true" with "1"

  • 我有一个类似的问题,但我希望for the column to input as text rather than a number. when I use Vlookup and the cell is a number (ie. 40144821), the Vlookup doesn't work. It does work if it reads as text however (ie. 40144821-01). The only work around I have found is to mannually re-enter the numbers. However, this applies to more than 50% of my cell values so is not a great option. I have tried importin csv and xcel files to the same end. I have also tried making the column a number field in the spreadsheet before importing. also does not work.

    Any suggestions?

  • AaronO
    AaronO ✭✭✭

    Wow, a five-year-old thread on this topic. This is terrible behavior. Maybe it's not a "bug" but the logic used to interpret column types is inscrutable.

    Consider this csv file:

    t1,t2,t3,t4 1,1,0,0.0 1,0,0,0.0 0,0,0,0.0 0,"hi",0,0.0

    Importing this results in:

    image.png

    Column t1 is a text/number column

    Column t2 is a checkbox column except it has some text in it

    Column t3 is a checkbox column

    Column t4 is a DROPDOWN column with only one option: 0

    There is not a world in which this is a useful interpretation. Column t1 is numbers but column t3 is checkboxes? Column t2 is checkboxes+other but Column t4 is a dropdown? Column t3 and t4 are both effectively all zeros but have different types?

    Almost everything I imported was a number but I can't add them together? If I add another column and put in a formula on the first row, this works: "=SUM([t1]@row:[t4]@row)" but this gives an error: "=[t3]@row + [t4]@row". (That's especially weird - SUM and + work differently?)

    And this is what bit me: if I import two sheets, one of which has all "0" in a certain column and the other has other values in that column, they can't be brought into a report together - the two columns are interpreted as being of different types and so can't be combined in the report. Forcing me to go in and fiddle with column types when all I interpreted was a lot of numbers is extremely confusing.

    It seems like it would be much better to just interpret everything as text/number - if I want to get fancy and turn things into other types, I can do that later. Or I could select the column type in the import dialog, with text/number as the default - that seems like a much better fit than (what seem like) arbitrary interpretations. If I'm importing data, it's almost certainly from a program that doesn't know about checkboxes, making a checkbox column is more likely to hurt than help!

    Aaron

  • AaronO
    AaronO ✭✭✭

    I should also note Shaine's question above: what are the drawbacks to changing the column type after import vs having an option to select the column type during import? It's a pain and it's confusing. I get that it's clever to do this interpretation, but the assumptions the tool is making (if a column is all 0, it must be checkboxes; if it's all 0.0 it must be a dropdown of 0s) don't make sense. Better to import it "vanilla" and let me decide where I want to get fancy.

    As pointed out, when I change a checkbox column to a number column, I get text "true" and "false" instead of the numbers I actually imported. In my example above, if I change column t3 to "text/number" it fills with "false" and then "=[t3]@row + [t4]@row" gives "false0" - clearly not useful!

    A

Fixed, needed to add \"Value\" before the formula to remove the apostrophe.<\/p>


<\/p>

=VALUE(IFERROR(JOIN(DISTINCT(COLLECT([Customer PO Amount (USD)]@row:[Customer PO Amount (Local Currency)]@row, [Customer PO Amount (USD)]@row:[Customer PO Amount (Local Currency)]@row, <>\"\"))), \" \"))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109460,"type":"question","name":"IF \/ OR formula then Check a Box","excerpt":"I need a formula that IF a specific column has either 1 of 2 specific choices, then a BOX in another column is checked: =IF(([Study Status]@row = \"Active\/ Open to Accrual\", 1) OR([Study Status]@row = \"In Start-Up\", 1))","snippet":"I need a formula that IF a specific column has either 1 of 2 specific choices, then a BOX in another column is checked: =IF(([Study Status]@row = \"Active\/ Open to Accrual\", 1)…","categoryID":321,"dateInserted":"2023-08-25T13:30:39+00:00","dateUpdated":null,"dateLastComment":"2023-08-25T16:21:27+00:00","insertUserID":9250,"insertUser":{"userID":9250,"name":"Susan Swisher","url":"https:\/\/community.smartsheet.com\/profile\/Susan%20Swisher","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-25T16:23:49+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"updateUserID":null,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":9,"countViews":45,"score":null,"hot":3385956126,"url":"https:\/\/community.smartsheet.com\/discussion\/109460\/if-or-formula-then-check-a-box","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109460\/if-or-formula-then-check-a-box","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109460,"commentID":392616,"name":"Re: IF \/ OR formula then Check a Box","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392616#Comment_392616","dateInserted":"2023-08-25T16:21:27+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T15:13:03+00:00","dateAnswered":"2023-08-25T14:14:39+00:00","acceptedAnswers":[{"commentID":392575,"body":"

Give this a try:<\/p>

=IF(OR([Study Status]@row = \"Active\/Open to Accrual\", [Study Status]@row = \"In Start-Up\"), 1)<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109457,"type":"question","name":"Conditional Formatting (modified date not in the last 3 weeks)","excerpt":"I would like to use Conditional Formatting (highlight the entire row yellow) if the modified date is not within the last 3 weeks. So any row that has not been recently updated (last 3 weeks) should be highlighted in yellow. Is this spmething that can be done directly within conditional formatting or should I first create a…","snippet":"I would like to use Conditional Formatting (highlight the entire row yellow) if the modified date is not within the last 3 weeks. So any row that has not been recently updated…","categoryID":321,"dateInserted":"2023-08-25T12:33:14+00:00","dateUpdated":null,"dateLastComment":"2023-08-25T12:40:57+00:00","insertUserID":161267,"insertUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":161267,"lastUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":26,"score":null,"hot":3385935251,"url":"https:\/\/community.smartsheet.com\/discussion\/109457\/conditional-formatting-modified-date-not-in-the-last-3-weeks","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109457\/conditional-formatting-modified-date-not-in-the-last-3-weeks","format":"Rich","tagIDs":[437],"lastPost":{"discussionID":109457,"commentID":392553,"name":"Re: Conditional Formatting (modified date not in the last 3 weeks)","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392553#Comment_392553","dateInserted":"2023-08-25T12:40:57+00:00","insertUserID":161267,"insertUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T12:40:09+00:00","dateAnswered":"2023-08-25T12:37:47+00:00","acceptedAnswers":[{"commentID":392551,"body":"

There is no direct way to do this. Adding a checkbox helper column with something similar to this and then formatting based on the checkbox is the simplest way. You can even hide the extra column, as there is no reason for it to be visible.<\/p>

=IF([Modified Date]@row < TODAY(-21), 1, 0)<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":437,"urlcode":"conditional-formatting","name":"Conditional Formatting"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=321&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":4991,"limit":3},"title":"Trending in Smartsheet Basics","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in Smartsheet Basics