#31 — Write The First Lines of Multiples CSV Files to Excel

Problem description & analysis:

There are multiple csv files of same structure in a certain directory:

Task: Take the first line of each file (without column headers) and write them to an Excel file.

Solution:

Write the following code in SP…


This content originally appeared on DEV Community and was authored by Judith-Excel-Sharing

Problem description & analysis:

There are multiple csv files of same structure in a certain directory:

original csv file

Task: Take the first line of each file (without column headers) and write them to an Excel file.

desired Excel file

Solution:

Write the following code in SPL IDE:

=T("result.xlsx": directory@p("D:\\data\\*.csv").(T(~)(1)))

Explanation:

directory@p lists file names with full paths according to the wild character. T()function reads files or writes data to a file as a specified format according to the file extension; ~ is the current member, and (1) represents the first line.


This content originally appeared on DEV Community and was authored by Judith-Excel-Sharing


Print Share Comment Cite Upload Translate Updates
APA

Judith-Excel-Sharing | Sciencx (2024-07-23T03:24:35+00:00) #31 — Write The First Lines of Multiples CSV Files to Excel. Retrieved from https://www.scien.cx/2024/07/23/31-write-the-first-lines-of-multiples-csv-files-to-excel/

MLA
" » #31 — Write The First Lines of Multiples CSV Files to Excel." Judith-Excel-Sharing | Sciencx - Tuesday July 23, 2024, https://www.scien.cx/2024/07/23/31-write-the-first-lines-of-multiples-csv-files-to-excel/
HARVARD
Judith-Excel-Sharing | Sciencx Tuesday July 23, 2024 » #31 — Write The First Lines of Multiples CSV Files to Excel., viewed ,<https://www.scien.cx/2024/07/23/31-write-the-first-lines-of-multiples-csv-files-to-excel/>
VANCOUVER
Judith-Excel-Sharing | Sciencx - » #31 — Write The First Lines of Multiples CSV Files to Excel. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/23/31-write-the-first-lines-of-multiples-csv-files-to-excel/
CHICAGO
" » #31 — Write The First Lines of Multiples CSV Files to Excel." Judith-Excel-Sharing | Sciencx - Accessed . https://www.scien.cx/2024/07/23/31-write-the-first-lines-of-multiples-csv-files-to-excel/
IEEE
" » #31 — Write The First Lines of Multiples CSV Files to Excel." Judith-Excel-Sharing | Sciencx [Online]. Available: https://www.scien.cx/2024/07/23/31-write-the-first-lines-of-multiples-csv-files-to-excel/. [Accessed: ]
rf:citation
» #31 — Write The First Lines of Multiples CSV Files to Excel | Judith-Excel-Sharing | Sciencx | https://www.scien.cx/2024/07/23/31-write-the-first-lines-of-multiples-csv-files-to-excel/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.