Jump to content

Excel and CSV files adding ' to leading zeros

Hey, 

 

I have to constantly convert an excel sheet with hundreds of barcodes as the CSV format is adding a ' to all barcodes with a leading zero. The format needs to be CSV or else the program we're using won't recognize it. 

 

Now I'm thinking it won't be an issue but I was wondering if there is a better way to do this. Excel also likes to convert some barcodes to scientific notation. Having to reconvert them all the time introduces issues such as removing some of the barcode and or adding zeros to the end. I'm trying to find a way around this so the next guy who doesn't have a background in this field modifies the reference data and ends up messing up all the barcodes. 

 

Any help would be appreciated. 

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, Rodinski said:

Hey, 

 

I have to constantly convert an excel sheet with hundreds of barcodes as the CSV format is adding a ' to all barcodes with a leading zero. The format needs to be CSV or else the program we're using won't recognize it. 

 

Now I'm thinking it won't be an issue but I was wondering if there is a better way to do this. Excel also likes to convert some barcodes to scientific notation. Having to reconvert them all the time introduces issues such as removing some of the barcode and or adding zeros to the end. I'm trying to find a way around this so the next guy who doesn't have a background in this field modifies the reference data and ends up messing up all the barcodes. 

 

Any help would be appreciated. 

How are you doing this currently?  What system are the barcodes coming from before hitting Excel?

 

You can add leading zeros thru formulas, then make a macro to do it.

 

 

"Do what makes the experience better" - in regards to PCs and Life itself.

 

Onyx AMD Ryzen 7 7800x3d / MSI 6900xt Gaming X Trio / Gigabyte B650 AORUS Pro AX / G. Skill Flare X5 6000CL36 32GB / Samsung 980 1TB x3 / Super Flower Leadex V Platinum Pro 850 / EK-AIO 360 Basic / Fractal Design North XL (black mesh) / AOC AGON 35" 3440x1440 100Hz / Mackie CR5BT / Corsair Virtuoso SE / Cherry MX Board 3.0 / Logitech G502

 

7800X3D - PBO -30 all cores, 4.90GHz all core, 5.05GHz single core, 18286 C23 multi, 1779 C23 single

 

Emma : i9 9900K @5.1Ghz - Gigabyte AORUS 1080Ti - Gigabyte AORUS Z370 Gaming 5 - G. Skill Ripjaws V 32GB 3200CL16 - 750 EVO 512GB + 2x 860 EVO 1TB (RAID0) - EVGA SuperNova 650 P2 - Thermaltake Water 3.0 Ultimate 360mm - Fractal Design Define R6 - TP-Link AC1900 PCIe Wifi

 

Raven: AMD Ryzen 5 5600x3d - ASRock B550M Pro4 - G. Skill Ripjaws V 16GB 3200Mhz - XFX Radeon RX6650XT - Samsung 980 1TB + Crucial MX500 1TB - TP-Link AC600 USB Wifi - Gigabyte GP-P450B PSU -  Cooler Master MasterBox Q300L -  Samsung 27" 1080p

 

Plex : AMD Ryzen 5 5600 - Gigabyte B550M AORUS Elite AX - G. Skill Ripjaws V 16GB 2400Mhz - MSI 1050Ti 4GB - Crucial P3 Plus 500GB + WD Red NAS 4TBx2 - TP-Link AC1200 PCIe Wifi - EVGA SuperNova 650 P2 - ASUS Prime AP201 - Spectre 24" 1080p

 

Steam Deck 512GB OLED

 

OnePlus: 

OnePlus 11 5G - 16GB RAM, 256GB NAND, Eternal Green

OnePlus Buds Pro 2 - Eternal Green

 

Other Tech:

- 2021 Volvo S60 Recharge T8 Polestar Engineered - 415hp/495tq 2.0L 4cyl. turbocharged, supercharged and electrified.

Lenovo 720S Touch 15.6" - i7 7700HQ, 16GB RAM 2400MHz, 512GB NVMe SSD, 1050Ti, 4K touchscreen

MSI GF62 15.6" - i7 7700HQ, 16GB RAM 2400 MHz, 256GB NVMe SSD + 1TB 7200rpm HDD, 1050Ti

- Ubiquiti Amplifi HD mesh wifi

 

Link to comment
Share on other sites

Link to post
Share on other sites

I'm using go canvas, but modifying their lists through excel. 

 

Turns out the ' is needed for leading zeros in order for it to read properly. But setting up a macro, I'll look into that. 

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, Rodinski said:

I'm using go canvas, but modifying their lists through excel. 

 

Turns out the ' is needed for leading zeros in order for it to read properly. But setting up a macro, I'll look into that. 

Yes, without the ' Excel will treat the cells as numbers, and drop the leading zeros.  The ' means text so it'll keep em.

 

 

"Do what makes the experience better" - in regards to PCs and Life itself.

 

Onyx AMD Ryzen 7 7800x3d / MSI 6900xt Gaming X Trio / Gigabyte B650 AORUS Pro AX / G. Skill Flare X5 6000CL36 32GB / Samsung 980 1TB x3 / Super Flower Leadex V Platinum Pro 850 / EK-AIO 360 Basic / Fractal Design North XL (black mesh) / AOC AGON 35" 3440x1440 100Hz / Mackie CR5BT / Corsair Virtuoso SE / Cherry MX Board 3.0 / Logitech G502

 

7800X3D - PBO -30 all cores, 4.90GHz all core, 5.05GHz single core, 18286 C23 multi, 1779 C23 single

 

Emma : i9 9900K @5.1Ghz - Gigabyte AORUS 1080Ti - Gigabyte AORUS Z370 Gaming 5 - G. Skill Ripjaws V 32GB 3200CL16 - 750 EVO 512GB + 2x 860 EVO 1TB (RAID0) - EVGA SuperNova 650 P2 - Thermaltake Water 3.0 Ultimate 360mm - Fractal Design Define R6 - TP-Link AC1900 PCIe Wifi

 

Raven: AMD Ryzen 5 5600x3d - ASRock B550M Pro4 - G. Skill Ripjaws V 16GB 3200Mhz - XFX Radeon RX6650XT - Samsung 980 1TB + Crucial MX500 1TB - TP-Link AC600 USB Wifi - Gigabyte GP-P450B PSU -  Cooler Master MasterBox Q300L -  Samsung 27" 1080p

 

Plex : AMD Ryzen 5 5600 - Gigabyte B550M AORUS Elite AX - G. Skill Ripjaws V 16GB 2400Mhz - MSI 1050Ti 4GB - Crucial P3 Plus 500GB + WD Red NAS 4TBx2 - TP-Link AC1200 PCIe Wifi - EVGA SuperNova 650 P2 - ASUS Prime AP201 - Spectre 24" 1080p

 

Steam Deck 512GB OLED

 

OnePlus: 

OnePlus 11 5G - 16GB RAM, 256GB NAND, Eternal Green

OnePlus Buds Pro 2 - Eternal Green

 

Other Tech:

- 2021 Volvo S60 Recharge T8 Polestar Engineered - 415hp/495tq 2.0L 4cyl. turbocharged, supercharged and electrified.

Lenovo 720S Touch 15.6" - i7 7700HQ, 16GB RAM 2400MHz, 512GB NVMe SSD, 1050Ti, 4K touchscreen

MSI GF62 15.6" - i7 7700HQ, 16GB RAM 2400 MHz, 256GB NVMe SSD + 1TB 7200rpm HDD, 1050Ti

- Ubiquiti Amplifi HD mesh wifi

 

Link to comment
Share on other sites

Link to post
Share on other sites

This is the sort of thing that is trivial to do with some command line utilities. I'm not clear from your question if you're trying to add the ' characters to the CSV before importing into Excel, or to remove them from the CSV after exporting from Excel, but either way it would be possible to set up a command/tool that you can pipe the CSV through before importing/after exporting.

 

I understand that this isn't a desirable solution for a lot of people, but if you're interested I could probably come up with something for you.

 

As far as the scientific notation thing, I've had that annoyance with Excel a lot myself. It really thinks it's smarter than its user when it comes to data formats. My favorite will always be the genes that scientists renamed to avoid Excel formatting them as dates automatically (which has happened in quite a few published papers without the authors noticing).

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×