DEV Community

Cover image for #31 — Write The First Lines of Multiples CSV Files to Excel
Judith-Excel-Sharing
Judith-Excel-Sharing

Posted on

#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:

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)))
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (2)

Collapse
 
judith677 profile image
Judith-Excel-Sharing

Stay tuned for more Excel hacks powered by esProc Desktop! If you have any challenging Excel tasks, feel free to reach out:
🔅Discord: discord.gg/hgbKEvJ4
🔅Reddit: reddit.com/r/esProc_Desktop/

We'd love to discuss more with you!

Collapse
 
judith677 profile image
Judith-Excel-Sharing

For more references⬇️
🔎SPL download address: scudata.com/download-Desktop
🔎Plugin Installation Method: c.scudata.com/article/1652061135502
🔎References to other rich Excel operation cases: c.raqsoft.com/article/1651916536524
🔎SPL Programming (YouTube FREE courses): youtube.com/playlist?list=PLQeR-Ih...