sql server - How to convert a group of xls 2 tab delimited files using ssis? -


how convert group of xls files tab delimited files using ssis ?

got script doing on google search.please sugest me how achieve using ssis

    dim objfso, objfile, objfiletsv     dim strline, strnewline, strnewtext     dim filenamelength, linelength, newfilename, linepos, quote, quotecount, totalfilesconverted      objfso = createobject("scripting.filesystemobject")     strcurpath = objfso.getabsolutepathname(".")     totalfilesconverted = 0      each objfile in objfso.getfolder(strcurpath).files         if ucase(right(objfile.name, 4)) = ".csv"             filenamelength = len(objfile.name) - 4             newfilename = left(objfile.name, filenamelength) & ".tsv"             objfile = objfso.opentextfile(objfile, 1)              until objfile.atendofstream                 strline = objfile.readline                 linelength = len(strline)                 linepos = 1                 strnewline = ""                 quote = false                 quotecount = 0                  while linepos <= linelength                     if mid(strline, linepos, 1) = "," , not quote                         strnewline = strnewline + vbtab                         quote = false                     elseif mid(strline, linepos, 1) = chr(34)                         quotecount = quotecount + 1                         if quotecount = 2 , linepos <> linelength                             if mid(strline, linepos, 2) = chr(34) & chr(34)                                 strnewline = strnewline + chr(34)                                 linepos = linepos + 1                                 quote = true                                 quotecount = 1                             else                                 quote = false                                 quotecount = 0                             end if                         else                             quote = true                         end if                     else                         strnewline = strnewline + mid(strline, linepos, 1)                     end if                     linepos = linepos + 1                 loop                 strnewtext = strnewtext & strnewline & vbcrlf             loop             objfile.close()              objfiletsv = objfso.createtextfile(newfilename)             objfiletsv.writeline(strnewtext)             totalfilesconverted = totalfilesconverted + 1             strnewtext = ""             objfiletsv.close()          end if     next      msgbox(cstr(totalfilesconverted) + " files converted csv tsv.") 

it has been understood ,this can used in script task..but let me have clues

assuming there no data transformation involved, simplest way create data flow task excel source , flat file destination. should set column delimiter field "tab {t}" in flat file connection manager.

as have multiple excel files in input, can use foreach loop above process each file.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -