#29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells

Problem description & analysis:
The Excel table below is ordered by column A, whose values are strings separated by “-”. The first part of column A represents the category.

Task: Store the table as multiple tab-separated txt files according to di…


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

Problem description & analysis:
The Excel table below is ordered by column A, whose values are strings separated by “-”. The first part of column A represents the category.

original table
Task: Store the table as multiple tab-separated txt files according to different categories. The file name format is Group_Category.txt.
Group_AA.txt

Group AA

Group_BB.txt

Group BB

Group_CC.txt

Group CC

Solution:
Use SPL IDE to execute the code:

=T@b("data.xlsx").group(#1.split("-")(1);~).(T@b("Group_" / #1 / ".txt": #2))

Explanation:
The T()function reads files as a table and writes a table to files; @ b means that column names are not included. group() function groups rows according to the specified rule and retains the detailed data in each group; ~ is the current member of the sequence, and #1 is the 1st column of the table.


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-19T04:04:21+00:00) #29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells. Retrieved from https://www.scien.cx/2024/07/19/29-group-an-excel-table-and-store-it-as-multiple-files-according-to-part-of-the-values-of-specified-cells/

MLA
" » #29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells." Judith-Excel-Sharing | Sciencx - Friday July 19, 2024, https://www.scien.cx/2024/07/19/29-group-an-excel-table-and-store-it-as-multiple-files-according-to-part-of-the-values-of-specified-cells/
HARVARD
Judith-Excel-Sharing | Sciencx Friday July 19, 2024 » #29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells., viewed ,<https://www.scien.cx/2024/07/19/29-group-an-excel-table-and-store-it-as-multiple-files-according-to-part-of-the-values-of-specified-cells/>
VANCOUVER
Judith-Excel-Sharing | Sciencx - » #29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/19/29-group-an-excel-table-and-store-it-as-multiple-files-according-to-part-of-the-values-of-specified-cells/
CHICAGO
" » #29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells." Judith-Excel-Sharing | Sciencx - Accessed . https://www.scien.cx/2024/07/19/29-group-an-excel-table-and-store-it-as-multiple-files-according-to-part-of-the-values-of-specified-cells/
IEEE
" » #29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells." Judith-Excel-Sharing | Sciencx [Online]. Available: https://www.scien.cx/2024/07/19/29-group-an-excel-table-and-store-it-as-multiple-files-according-to-part-of-the-values-of-specified-cells/. [Accessed: ]
rf:citation
» #29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells | Judith-Excel-Sharing | Sciencx | https://www.scien.cx/2024/07/19/29-group-an-excel-table-and-store-it-as-multiple-files-according-to-part-of-the-values-of-specified-cells/ |

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.