Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to split a large Excel file into multiple small files

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to split a large Excel file into multiple small files, in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

For a variety of reasons, sometimes we have to split a large Excel into small files. This algorithm can be implemented in VBA, but the code is very difficult to write and is prone to memory overflows.

It's much easier to use esProc, for example, to split a large file into a small file every 1500 lines, with only a few lines:

ABD1=file ("dt.xlsx") .xlsimport@t () / Open Excel, assuming that the first line is the title 2for A1.group ((#-1)\ 1500)

/ cyclic fetch, 1500 lines 3 at a time

= file (# A2 / ".xlsx") .xlsexport (A2) / generate small Excel, filename is number of cycles

Sometimes it is possible to split by column grouping, for example, the title of the first row of Excel is col1, col2... And has been sorted by col1 (which can be arranged in Excel beforehand), we want to split it into multiple Excel according to col1. The code is also simple:

ABD1=file (dt.xlsx) .xlsimport@t ()

2for A1.group (col1)

/ group round robin 3 by col1

= file (A2.col1/ ".xlsx") .xlsexport @ t (A2) / small file name is the grouping name

It is also easy to combine the first two requirements (that is, grouped by col1, but up to 1500 lines of subfiles):

ABCD1=file (dt.xlsx) .xlsimport@t ()

2for A1.group (col1)

/ group round robin 3 by col1

For A2.group ((#-1)\ 1500)

/ then take 1500 4 per cycle

= file (B3.col1/#B3/ ".xlsx") .xlsexport @ t (B3) / small file name is grouped name + number of loops

EsProc is a scripting language that can be executed in desktop IDE and the data is presented in a table. It is convenient to debug this looping algorithm.

The answer to the question about how to split the large Excel file into multiple small files is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report