How to convert csv to excel
How to convert csv to excel
Преобразование CSV-файла в электронную таблицу Excel
Файл с разделенными запятыми значениями (CSV) — это текстовый файл с разделителями, в котором для разделения серии значений используется определенный символ.
Power Automate позволяет открывать CSV-файлы с разделителями-запятыми и разделителями-табуляторами непосредственно через действие Запустить Excel.
Чтобы преобразовать CSV-файл этого типа в XLSX, откройте файл и затем сохраните его как новую книгу Excel с помощью параметра Сохранить документ как в действии Закрыть Excel.
Хотя действие Запустить Excel может обрабатывать ранее упомянутые случаи, CSV-файлы, разделенные точками с запятой, могут потребовать другого подхода.
Excel использует разделители списков, определенные в региональных настройках Windows. В некоторых регионах необходимо вручную установить символ точки с запятой в качестве разделителя или применить следующее решение проблемы.
Чтобы преодолеть это ограничение, разверните действие Считать из CSV-файла и установите символ точки с запятой (;) в качестве настраиваемого разделителя в дополнительных параметрах. Если первая строка CSV-файла содержит заголовки, включите параметр Первая строка содержит имена столбцов, чтобы использовать соответствующие заголовки в извлеченной таблице данных.
Затем запустите пустой документ Excel, используя действие Запустить Excel и вставьте CSV-таблицу в ячейку A1, используя действие Записать в лист Excel.
Теперь вы можете развернуть действие Закрыть Excel, чтобы сохранить лист Excel как новый файл XLSX.
Convert a CSV file into an Excel spreadsheet
A comma-separated values file (CSV) is a delimited text file that uses a specific character to separate a series of values.
Power Automate allows you to open comma-delimited and tab-delimited CSV files directly through the Launch Excel action.
To convert a CSV file of this type to XLSX, open the file and then save it as a new Excel workbook using the Save document as option in the Close Excel action.
Although the Launch Excel action can handle the previously mentioned cases, semicolon-delimited CSV files may require a different approach.
Excel uses the list separators defined in the Windows regional settings. In some regions, you have to manually set the semicolon character as a separator or apply the following workaround.
To overcome this limitation, deploy the Read from CSV file action and set the semicolon character (;) as a custom separator in the advanced options. If the first row of the CSV file contains headers, enable the First line contains column names option to use the respective headers at the retrieved datatable.
Next, launch a blank Excel document using the Launch Excel action and paste the CSV table into cell A1 using the Write to Excel worksheet action.
Now, you can deploy the Close Excel action to save the Excel worksheet as a new XLSX file.
There are two ways to import data from a text file with Excel: you can open it in Excel, or you can import it as an external data range. To export data from Excel to a text file, use the Save As command and change the file type from the drop-down menu.
There are two commonly used text file formats:
Delimited text files (.txt), in which the TAB character (ASCII character code 009) typically separates each field of text.
Comma separated values text files (.csv), in which the comma character (,) typically separates each field of text.
Note: You can import or export up to 1,048,576 rows and 16,384 columns.
Import a text file by opening it in Excel
Go to File > Open and browse to the location that contains the text file.
Select Text Files in the file type dropdown list in the Open dialog box.
Locate and double-click the text file that you want to open.
If the file is a text file (.txt), Excel starts the Import Text Wizard. When you are done with the steps, click Finish to complete the import operation. See Text Import Wizard for more information about delimiters and advanced options.
Import a text file by connecting to it (Power Query)
You can import data from a text file into an existing worksheet.
On the Data tab, in the Get & Transform Data group, click From Text/CSV.
In the Import Data dialog box, locate and double-click the text file that you want to import, and click Import.
In the preview dialog box, you have several options:
Select Load if you want to load the data directly to a new worksheet.
Alternatively, select Load to if you want to load the data to a table, PivotTable/PivotChart, an existing/new Excel worksheet, or simply create a connection. You also have the choice of adding your data to the Data Model.
Select Transform Data if you want to load the data to Power Query, and edit it before bringing it to Excel.
If Excel doesn’t convert a particular column of data to the format that you want, then you can convert the data after you import it. For more information, see Convert numbers stored as text to numbers and Convert dates stored as text to dates.
Export data to a text file by saving it
You can convert an Excel worksheet to a text file by using the Save As command.
Go to File > Save As.
In the Save As dialog box, under Save as type box, choose the text file format for the worksheet; for example, click Text (Tab delimited) or CSV (Comma delimited).
Note: The different formats support different feature sets. For more information about the feature sets that are supported by the different text file formats, see File formats that are supported in Excel.
Browse to the location where you want to save the new text file, and then click Save.
A dialog box appears, reminding you that only the current worksheet will be saved to the new file. If you are certain that the current worksheet is the one that you want to save as a text file, click OK. You can save other worksheets as separate text files by repeating this procedure for each worksheet.
You may also see an alert below the ribbon that some features might be lost if you save the workbook in a CSV format.
For more information about saving files in other formats, see Save a workbook in another file format.
Import a text file by connecting to it
You can import data from a text file into an existing worksheet.
Click the cell where you want to put the data from the text file.
On the Data tab, in the Get External Data group, click From Text.
In the Import Data dialog box, locate and double-click the text file that you want to import, and click Import.
Follow the instructions in the Text Import Wizard. Click Help on any page of the Text Import Wizard for more information about using the wizard. When you are done with the steps in the wizard, click Finish to complete the import operation.
In the Import Data dialog box, do the following:
Under Where do you want to put the data?, do one of the following:
To return the data to the location that you selected, click Existing worksheet.
To return the data to the upper-left corner of a new worksheet, click New worksheet.
Optionally, click Properties to set refresh, formatting, and layout options for the imported data.
Excel puts the external data range in the location that you specify.
If Excel does not convert a column of data to the format that you want, you can convert the data after you import it. For more information, see Convert numbers stored as text to numbers and Convert dates stored as text to dates.
Export data to a text file by saving it
You can convert an Excel worksheet to a text file by using the Save As command.
Go to File > Save As.
The Save As dialog box appears.
In the Save as type box, choose the text file format for the worksheet.
For example, click Text (Tab delimited) or CSV (Comma delimited).
Note: The different formats support different feature sets. For more information about the feature sets that are supported by the different text file formats, see File formats that are supported in Excel.
Browse to the location where you want to save the new text file, and then click Save.
A dialog box appears, reminding you that only the current worksheet will be saved to the new file. If you are certain that the current worksheet is the one that you want to save as a text file, click OK. You can save other worksheets as separate text files by repeating this procedure for each worksheet.
A second dialog box appears, reminding you that your worksheet may contain features that are not supported by text file formats. If you are interested only in saving the worksheet data into the new text file, click Yes. If you are unsure and would like to know more about which Excel features are not supported by text file formats, click Help for more information.
For more information about saving files in other formats, see Save a workbook in another file format.
The way you change the delimiter when importing is different depending on how you import the text.
If you use Get & Transform Data > From Text/CSV, after you choose the text file and click Import, choose a character to use from the list under Delimiter. You can see the effect of your new choice immediately in the data preview, so you can be sure you make the choice you want before you proceed.
If you use the Text Import Wizard to import a text file, you can change the delimiter that is used for the import operation in Step 2 of the Text Import Wizard. In this step, you can also change the way that consecutive delimiters, such as consecutive quotation marks, are handled.
See Text Import Wizard for more information about delimiters and advanced options.
Clear Excel Options > Advanced > Editing options > Use system separators.
Caution: Changing the Windows setting will cause a global change on your computer, affecting all applications. To only change the delimiter for Excel, see Change the default list separator for saving files as text (.csv) in Excel.
In Microsoft Windows 10, right-click the Start button, and then click Settings.
Click Time & Language, and then click Region in the left panel.
In the main panel, under Regional settings, click Additional date, time, and regional settings.
Under Region, click Change date, time, or number formats.
In the Region dialog, on the Format tab, click Additional settings.
In the Customize Format dialog, on the Numbers tab, type a character to use as the new separator in the List separator box.
In Microsoft Windows, click the Start button, and then click Control Panel.
Under Clock, Language, and Region, click Change date, time, or number formats.
In the Region dialog, on the Format tab, click Additional settings.
In the Customize Format dialog, on the Numbers tab, type a character to use as the new separator in the List separator box.
Note: After you change the list separator character for your computer, all programs use the new character as a list separator. You can change the character back to the default character by following the same procedure.
Need more help?
You can always ask an expert in the Excel Tech Community or get support in the Answers community.
Преобразовываем CSV в Excel: как импортировать файлы CSV в электронные таблицы Excel
В этой статье Вы найдёте 2 простых способа преобразовать файл CSV в Excel. Кроме того, Вы узнаете, как импортировать в Excel несколько файлов CSV и как справиться с ситуациями, когда часть данных из файла CSV не отображается корректно на листе Excel.
Эта статья покажет Вам, как открывать CSV в Excel и как импортировать одновременно несколько файлов CSV. Мы также обозначим возможные подводные камни и предложим наиболее эффективные решения.
Как преобразовать CSV в Excel
Если Вам нужно вытащить какую-то информацию на лист Excel из базы данных Вашей компании, то первая же идея, что приходит на ум, – экспортировать базу данных в файл CSV, а затем импортировать файл CSV в Excel.
Существует 3 способа преобразования CSV в Excel: Вы можете открыть файл с расширением .csv непосредственно в Excel, дважды кликнуть по файлу в Проводнике Windows либо импортировать CSV в Excel, как внешний источник данных. Далее я подробно расскажу об этих трёх способах и укажу преимущества и недостатки каждого из них.
Как открыть файл CSV в Excel
Даже если файл CSV создан в другой программе, Вы всегда можете открыть его как книгу Excel при помощи команды Open (Открыть).
Если Вы открываете файл CSV, то Excel откроет его сразу же вставив данные в новую книгу Excel. Если Вы открываете текстовый файл (.txt), то Excel запустит Мастер импорта текстов. Подробнее об этом читайте в разделе Импортируем CSV в Excel.
Замечание: Когда Microsoft Excel открывает файл CSV, то для того, чтобы понять, как именно импортировать каждый столбец данных, он использует настройки форматирования, заданные по умолчанию.
Если данные соответствуют хотя бы одному из следующих пунктов, то воспользуйтесь Мастером импорта текстов:
Чтобы заставить Excel запустить Мастер импорта текстов, Вы можете либо изменить расширение фала с .csv на .txt (прежде чем открывать файл), либо импортировать CSV в Excel так, как это будет описано далее.
Как открыть файл CSV при помощи Проводника Windows
Это самый быстрый способ открыть CSV в Excel. В Проводнике Windows дважды кликните по файлу .csv, и он откроется как новая книга Excel.
Однако, этот способ сработает только в том случае, если приложение Microsoft Excel установлено как программа, заданная по умолчанию, для открытия файлов .csv. Если это так, то Вы будете видеть знакомую иконку в Проводнике Windows рядом с именем файла.
Если Excel не является программой по умолчанию, вот как Вы можете это исправить:
Как импортировать CSV в Excel
Этим способом Вы можете импортировать данные из файла .csv в существующий или в новый лист Excel. В отличие от предыдущих двух способов, он не просто открывает CSV в Excel, а именно конвертирует формат .csv в .xlsx (если Вы используете Excel 2007, 2010 или 2013) или .xls (в версиях Excel 2003 и более ранних).
Прежде, чем мы двинемся дальше, пожалуйста, посмотрите на снимок экрана ниже, на нем показан исходный файл CSV и желаемый результат в Excel. Надеюсь, это поможет Вам лучше понять, почему мы выбираем те или иные параметры настроек в последующем примере.
Совет: Если в Вашем файле CSV используется последовательно более одной запятой или другого символа-разделителя, то поставьте галочку для параметра Treat consecutive delimiters as one (Считать последовательные разделители одним), чтобы избежать появления пустых ячеек.
Совет: Вы можете нажать кнопку Properties (Свойства), чтобы настроить дополнительные параметры, такие как обновление, разметка и форматирование для импортированных данных.
Замечание: Если Ваш файл CSV содержит численные данные или даты, Excel может преобразовать их с ошибками. Чтобы изменить формат импортированных данных, выберите столбец (столбцы), в которых возникли ошибки, кликните по ним правой кнопкой мыши и в контекстном меню выберите Format cells (Формат ячеек).
Преобразование CSV в Excel: проблемы и решения
Формат CSV используется уже более 30 лет, но несмотря на его длительную историю, он никогда не был официально задокументирован. Название CSV (Comma-Separated Values) возникло из-за использования запятых для разделения полей данных. Но это в теории. На самом деле, множество так называемых CSV-файлов используют другие символы для разделения данных, например:
Некоторые вариации файлов CSV разделяют поля данных одинарными или двойными кавычками, другие требуют маркер последовательности байтов из Юникода (BOM), например, UTF-8, для корректной интерпретации Юникода.
Файл CSV отображается в Excel неправильно
Признаки: Вы пытаетесь открыть файл CSV в Excel, и все данные попадают в первый столбец.
Причина: Корень проблемы кроется в том, что в Ваших региональных и языковых настройках Windows и в Вашем файле CSV установлены различные разделители. В Северной Америке и некоторых других странах разделителем полей списка по умолчанию является запятая. В то время как в Европейских странах запятая используется как разделитель десятичных разрядов, а разделителем полей списка является точка с запятой.
Решение: Есть несколько возможных решений этой проблемы. Вы можете быстро просмотреть приведённые ниже рекомендации и выбрать наиболее подходящие для конкретно Вашей задачи.
Замечание: Все показанные решения изменяют разделитель только для данного файла CSV. Если Вы хотите раз и навсегда изменить разделитель, заданный по умолчанию, то Вам подойдёт следующее решение.
Примечание переводчика: Данные настройки приведены для английской локализации Excel (и ряда других стран). Для русской локализации привычнее будет использовать запятую в качестве разделителя целой и дробной части и точку с запятой для разделения элементов списка.
Замечание: Установка в Панели управления Windows символов-разделителей целой и дробной части и элементов списка изменит настройки символов, заданные по умолчанию, для всех программ на Вашем компьютере, а не только в Microsoft Excel.
Первые нули теряются при открытии файла CSV в Excel
Признаки: Ваш файл CSV содержит значения с первыми нулями, и эти нули теряются при открытии файла CSV в Excel.
Причина: По умолчанию, Microsoft Excel отображает файл CSV в формате General (Общий), в котором первые нули отсекаются.
На шаге 3 мастера выберите столбцы, содержащие значения с первыми нулями и измените формат этих столбцов на текстовый. Так Вы конвертируете Ваш файл CSV в Excel, сохранив нули на своих местах.
Excel преобразует некоторые значения в даты при открытии файла CSV
Признаки: Некоторые значения в Вашем файле CSV похожи на даты, и Excel автоматически преобразует такие значения из текстового формата в формат даты.
Причина: Как упоминалось выше, Excel открывает файл CSV в формате General (Общий), при этом значения, похожие на даты, преобразует из текстового формата в формат даты. Например, если Вы открываете файл CSV, содержащий логины пользователей, то запись «апр23» будет преобразована в дату.
Решение: Преобразуйте файл CSV в Excel при помощи Мастера импорта текстов. На шаге 3 мастера выберите столбцы с записями, похожими на даты, и измените формат столбца на текстовый.
Если Вам нужно достичь противоположного результата, то есть в определённом столбце преобразовать значения в даты, тогда установите формат Date (Дата) и выберите подходящий формат даты в выпадающем списке.
Как импортировать в Excel несколько файлов CSV
Думаю, Вы знаете, что Microsoft Excel позволяет открывать несколько файлов CSV при помощи команды Open (Открыть).
Этот способ простой и быстрый, и мы могли бы назвать его отличным, если бы не одно обстоятельство – каждый файл CSV открывается таким образом как отдельная книга Excel. На практике переключение туда-сюда между несколькими открытыми файлами Excel может быть крайне неудобным и обременительным.
Надеюсь, теперь Вы легко сможете преобразовать любой файл CSV в Excel. Если у Вас возникают какие-либо вопросы или сложности, смело пишите мне в комментариях. И благодарю за терпение каждого, кто осилил чтение этой длинной статьи до самого конца! 🙂
How to convert (open or import) CSV file to Excel
by Svetlana Cheusheva | updated on August 13, 2022
The tutorial explains how to quickly convert CSV files to Excel in any version, from 365 to 2007, avoiding typical issues.
Convert CSV file to Excel by opening it
To bring data from a CSV file to Excel, you can open it directly from an Excel workbook or via Windows Explorer. Whichever method you choose, please keep in mind that:
How to open CSV file in Excel
A comma separated values file created in another program can still be opened in Excel by using the standard Open command.
A comma separated values file (.csv) will be opened in a new workbook straight away.
For a text file (.txt), Excel will start the Import Text Wizard. See Importing CSV to Excel for full details.
How to open CSV file from Windows Explorer
If your CSV files are set to open with another default app, then right-click the file, and choose Open with… > Excel.
To set Excel as the default program for CVS files, here are the steps to perform:
Convert CSV to Excel by importing it
Importing can be done in two ways:
How to import CSV into Excel with Text Import Wizard
First off, it should be noted that the Text Import Wizard is a legacy feature, and beginning with Excel 2016 it is moved from the ribbon to Excel Options.
If the Text Import Wizard is not available in your Excel version, you have these two options:
To import a CSV file to Excel, this is what you need to do:
In Excel 2016 and later, go to the Data tab > Get & Transform Data group, and click Get Data > Legacy Wizards > From Text (Legacy).
Note. If the From Text wizard is not there, make sure you have it enabled. If Legacy Wizards is still grayed out, select an empty cell or open a blank worksheet and try again.
Delimiter is the character that separates values in your file. As CSV is a comma separated values file, obviously you select Comma. For a TXT file, you’d typically select Tab.
Text qualifier is the character that encloses the values in an imported file. All text between two qualifier characters will be imported as one value, even if the text contains the specified delimiter.
Generally, you choose the double quote symbol («) as text qualifier. To check this, you can click Back and see which character encloses the values in the preview of your CSV file.
In our case, all numbers with a thousands separator (which is also a comma) are wrapped in double quotes like «3,392», meaning they will be imported in one cell. Without specifying the double quote sign as the text qualifier, the numbers before and after a thousands separator would go into two adjacent columns.
To make sure your data will be imported as intended, look carefully at the Data preview before clicking Next.
To set another format for a specific column, click anywhere within it in the Data Preview, and then choose one of the options under Column data format:
When you are happy with the Data preview, click the Finish button.
To activate the Text Import Wizard in modern versions of Excel, this is what you need to do:
Once enabled, the wizard will appear on the Data tab, in the Get & Transform Data group, under Get Data > Legacy Wizards.
How to transfer CSV to Excel by connecting to it
In Excel 365, Excel 2021, Excel 2019 and Excel 2016, you can import data from a text file by connecting to it with the help of Power Query. Here’s how:
Clicking the Load button will import the CSV data in the table format like this one:
The imported table is linked to the original CSV document, and you can update it anytime by refreshing the query (Table Design tab > Refresh).
Converting CSV to Excel: opening vs. importing
If your text file has specific values and you want to control how to display them in Excel, then do importing rather than opening. Here are a few typical use cases:
How to save CSV file in Excel
Whichever conversion method you used, you can save the resulting file like you normally would.
How to open multiple CSV files in Excel at once
As you probably know, Microsoft Excel allows opening several workbooks at a time using the standard Open command. This also works for CSV files.
To open multiple CSV files in Excel, here are the steps for you to follow:
In Windows Explorer, you can right-click the selected files and pick Open from the context menu.
Hopefully, now you are able to convert any CSV files to Excel with ease. And thank you for your patience everyone who has read this tutorial to the end 🙂
Источники информации:
- http://docs.microsoft.com/en-us/power-automate/desktop-flows/how-to/convert-csv-excel
- http://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba
- http://office-guru.ru/excel/preobrazovyvaem-csv-v-excel-kak-importirovat-faily-csv-v-elektronnye-tablicy-excel-368.html
- http://www.ablebits.com/office-addins-blog/convert-csv-excel/