XEROF

 

xlsgen 4.5.0.55 : Import and split columns


Build 4.5.0.55 of xlsgen improves the import from CSV, XML, JSON and HTML files, by adding the ability to split columns.

Let's take an example of a data table including a person's name. This name often differentiates the first and last name in different columns, ie :


Data with first and last names in separate columns

But sometimes both are in the same column, separated by a special character, here a comma :


Data with both first and last names in the same column

In the latter case, xlsgen can import the data in separate columns. The mechanism is available for all import file formats, ie CSV, XML, JSON and HTML.


VB code


' import a CSV file, split Name column in two First name and Last name columns

Dim wbk As xlsgen.IXlsWorkbook
Set wbk = engine.New("ResultingFile.xlsx")

Dim wksht As xlsgen.IXlsWorksheet
Set wksht = wbk.AddWorksheet("Sheet1")

Dim cs As xlsgen.IXlsImportColumnSplitter
Set cs = wksht.Import.CSV.Options.ColumnSplitByName("Name")

cs.SplitBySeparator = ","
cs.AddColumn("First name")
cs.AddColumn("Last name")

wksht.Import.CSV.ImportFile ("datasource.csv")



Other than splitting based on a special character, the split can be based on a string length. For instance, if you know the data is made of 3 pieces of 10 characters each, you can set SplitByLength to 10.

Each split column can have its own style and number format. This is specified in the IXlsImportColumnSplit interface.

Posted on 28-March-2019 11:50 | Category: xlsgen, Excel generator | comment[0] | trackback[0]

 

 

<-- previous page

< July >
0102030405
0607080910
1112131415
1617181920
2122232425
2627282930
31



 

 

This site
Home
Articles

DevTools
CPU-Z
EditPlus
ExplorerXP
Kill.exe
OllyDbg
DependencyWalker
Process Explorer
autoruns.exe
Araxis
COM Trace injection
CodeStats
NetBrute
FileMon/Regmon
BoundsChecker
AQTime profiler
Source monitor
GDI leaks tracking
Rootkit revealer
Rootkit removal
RunAsLimitedUser(1)
RunAsLimitedUser(2)

 

 

Liens
Le Plan B
Un jour à Paris
Meneame
Rezo.net (aggr)
Reseau voltaire
Cuba solidarity project
Le grand soir
L'autre journal
Le courrier suisse
L'Orient, le jour
Agoravox (aggr)