Data Export to CSV - wrong formats for price

  • Posts: 9
  • Thank you received: 2
  • Hikashop Essential
1 day 7 hours ago #372858

-- HikaShop version -- : 652
-- Joomla version -- : 547
-- PHP version -- : 8.3
-- Browser(s) name and version -- : firefox

Hi there,

when exporting products into CV-file in the column AT (=product_sort_price) some prices are shown in the right format (Excel. "Standard").
Others are given in a date-format, e.g. "Sep99"; although in the backend the correct price "9.99" (EUR) was entered.

Please see CSV-file in attachment, column AT.

Thanks.

Rolf

P.S.: Additional question - what format must CSV-file be stord CSV /S-DOS, or CSV-separators?

This message has an attachment file.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

  • Posts: 85952
  • Thank you received: 14140
  • MODERATOR
22 hours 44 minutes ago #372860

Hello,

This is not a HikaShop problem, the data in the CSV file is correct. It's Excel that changes it when you open the file. When you double click a CSV, Excel auto-detects each cell and turns anything that looks like a date into a date. In a locale where the point is not the decimal separator, "9.99" is read as month 9 / year 99, so Excel shows "Sep99" (September 1999). That's why only some values are affected: only the ones Excel can read as a date get converted, the others stay as numbers.

You can check it: open the exported file with a plain text editor (Notepad), and you'll see the correct value 9.99. The export is fine, it's only the display in Excel that is wrong.

To keep the prices intact, you have a few options:

1. Export in XLSX instead of CSV. Create a mass action on the products (System > Mass actions) and choose the XLSX export format. XLSX stores real number cells, so Excel never turns them into dates. This is the cleanest solution.

2. Set the "CSV decimal separator" to a comma in the HikaShop configuration (main tab). The prices are then exported as "9,99", which a European Excel reads directly as numbers instead of dates.

3. Or open the CSV without letting Excel convert it: in Excel, go to Data > From Text/CSV, select the file, and set the price column type to "Text" (or the matching locale) before loading. The values then stay exactly as exported.

About your second question, on how to save it: the encoding (CSV UTF-8 vs CSV MS-DOS) only affects accented characters, it doesn't cause the date issue, so keep CSV UTF-8 to preserve special characters. The field separator HikaShop uses is set in that same configuration page ("CSV separator", semicolon by default).

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 2
  • Hikashop Essential
19 hours 1 minute ago #372862

Hello,

thanks for quick reply.

1. When I export by MASS-ACTION to .xlsx - can I import also from .xlsx? Or shall I save as .csv after working on file?
3. How shall i change price column type before loading?? When I click "Export" the .csv file appears immediately, no point where I can change anything before opening the file

Thanks for info, have anice weekend.

Rolf

Please Log in or Create an account to join the conversation.

  • Posts: 85952
  • Thank you received: 14140
  • MODERATOR
14 hours 9 minutes ago #372864

Hello,

1. No, the import only reads CSV files, there is no XLSX import. So if you export in XLSX to work on the file safely, you then need to save it back as CSV ( File > Save As > CSV UTF-8 ) before importing it.

That is not a problem for the prices: the import accepts both the point and the comma as decimal separator, and it auto detects the field separator from the first line of the file. So a CSV saved by a German Excel (semicolon as separator, 9,99 as price) is imported correctly, you don't have to convert anything back.

2. That step is done in Excel, not in HikaShop. The export simply gives you the file, and the conversion happens later, when Excel opens it. So don't double click the downloaded file. Instead:

- Save the exported file somewhere on your disk without opening it.
- Open Excel with an empty workbook.
- Go to the Data tab, then "From Text/CSV", and select the file.
- In the preview window that appears, you have options to configure how Excel will process the CSV and you can adapt them so that the problem doesn't appear.

Last edit: 18 hours 11 minutes ago by nicolas.

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum