<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Speeding up export to CSV in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Speeding-up-export-to-CSV/m-p/735170#M263144</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create the required table in the script and store it to a csv file. Or create another table box with the right columns and export that by right clicking it and choosing Export... and select Comma Delimited (*.csv, *.txt) as output format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Oct 2014 12:42:54 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2014-10-01T12:42:54Z</dc:date>
    <item>
      <title>Speeding up export to CSV</title>
      <link>https://community.qlik.com/t5/QlikView/Speeding-up-export-to-CSV/m-p/735169#M263143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a macro that picks data from certain columns and writes that data into a CSV file, but its really really slow.&lt;/P&gt;&lt;P&gt;Taking nearly 1.5 hours to create a CSV with 64000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the reason it is so slow is because I am using a for loop, but I don't know any other way, is there anyone who knows of a faster more efficient way of doing this?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt; text-indent: 36pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;set tb = ActiveDocument.GetSheetObject("TB01")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set XLApp = CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;&amp;nbsp; XLApp.Visible = False&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set XLDoc = XLApp.Workbooks. Add&lt;/P&gt;&lt;P&gt;&amp;nbsp; set objExcelSheet = XLDoc.Worksheets(1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set campaignNotes1 = ActiveDocument.GetVariable("VarA")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set tb = ActiveDocument.GetSheetObject("TB01")&lt;/P&gt;&lt;P&gt;&amp;nbsp; tb.AddField("ExternalId")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; columnCount = tb.GetColumnCount&lt;/P&gt;&lt;P&gt;&amp;nbsp; rowCount = tb.GetRowCount - 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; for currentRow = 1 to rowCount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'Does this customer have TPS?&lt;/P&gt;&lt;P&gt;&amp;nbsp; tps = tb.GetCell(currentRow,17).Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if tps = "Y" then&lt;/P&gt;&lt;P&gt;&amp;nbsp; tpsDataIncluded = true&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'msgbox ("Exported Cancelled - The data selected includes phone numbers that are TPS")&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'exit For&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; leadId1 = tb.GetCell(currentRow,1).Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; externalId = tb.GetCell(currentRow,columnCount-1).Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; businessName = tb.GetCell(currentRow,0).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; title = tb.GetCell(currentRow,3).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; fname = tb.GetCell(currentRow,4).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; lname = tb.GetCell(currentRow,5).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; postcode = tb.GetCell(currentRow,11).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; companyEmail = tb.GetCell(currentRow,15).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; otherEmail = tb.GetCell(currentRow,16).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; telephone = tb.GetCell(currentRow,13).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'msgbox tb.GetCell(currentRow,14).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; position1 = tb.GetCell(currentRow,14).Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; leadId = tb.GetCell(currentRow,1).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; add1 = tb.GetCell(currentRow,6).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; add2 = tb.GetCell(currentRow,7).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; locality = tb.GetCell(currentRow,8).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; town = tb.GetCell(currentRow,9).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; county = tb.GetCell(currentRow,10).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; heading = tb.GetCell(currentRow,19).Text&lt;/P&gt;&lt;P&gt;&amp;nbsp; url = tb.GetCell(currentRow,36).Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; 'Create CSV FILE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; row = currentRow + 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; customerId = "LeadId_" &amp;amp; leadId&lt;/P&gt;&lt;P&gt;&amp;nbsp; address = add1 &amp;amp; " " &amp;amp; add2 &amp;amp; " " &amp;amp; locality&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; email = ""&lt;/P&gt;&lt;P&gt;&amp;nbsp; if otherEmail = "" then&lt;/P&gt;&lt;P&gt;&amp;nbsp; if not companyEmail = "" then&lt;/P&gt;&lt;P&gt;&amp;nbsp; email = companyEmail&lt;/P&gt;&lt;P&gt;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp; email = ""&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp; email = otherEmail&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if not telno = "" then&lt;/P&gt;&lt;P&gt;&amp;nbsp; telephone = Right(telno,Len(telno)-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; telephone = Replace(telephone, " ", "", 1, -1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if typeOfFile = "ELocation" then&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,1) = customerId&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,2) = businessName&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,3) = title&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,4) = fname&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,5) = lname&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,6) = telephone&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,9) = email&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,10) = address&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,11) = town&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,12) = postcode&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,13) = heading&lt;/P&gt;&lt;P&gt;&amp;nbsp; else 'Dialler&lt;/P&gt;&lt;P&gt;&amp;nbsp; contactName = title &amp;amp; " " &amp;amp; fname &amp;amp; " " &amp;amp; lname&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,1) = customerId&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,2) = businessName&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,3) = contactName&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,4) = telephone&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,6) = url&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,7) = email&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,8) = address&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,9) = town&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,10) = postcode&lt;/P&gt;&lt;P&gt;&amp;nbsp; objExcelSheet.Cells(row,11) = heading&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CSVFilname = var &amp;amp; ".csv"&lt;/P&gt;&lt;P&gt;&amp;nbsp; if typeOfFile = "ELocation" then&lt;/P&gt;&lt;P&gt;&amp;nbsp; strFileName = "\\vsdat10\data\Farnborough\MIS\MIS\Vaishali\CM\" &amp;amp; CSVFilname&lt;/P&gt;&lt;P&gt;&amp;nbsp; else 'Dialler&lt;/P&gt;&lt;P&gt;&amp;nbsp; strFileName = "\\vsdat10\data\Farnborough\MIS\MIS\Vaishali\CM\" &amp;amp; CSVFilname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if tpsDataIncluded = true then&lt;/P&gt;&lt;P&gt;&amp;nbsp; msgbox ("Some data has been excluded from the export as it is TPS")&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; XLDoc.SaveAs(strFilename)&lt;/P&gt;&lt;P&gt;&amp;nbsp; XLDoc.Close()&lt;/P&gt;&lt;P&gt;&amp;nbsp; XLApp.Quit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 12:19:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Speeding-up-export-to-CSV/m-p/735169#M263143</guid>
      <dc:creator />
      <dc:date>2014-10-01T12:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Speeding up export to CSV</title>
      <link>https://community.qlik.com/t5/QlikView/Speeding-up-export-to-CSV/m-p/735170#M263144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create the required table in the script and store it to a csv file. Or create another table box with the right columns and export that by right clicking it and choosing Export... and select Comma Delimited (*.csv, *.txt) as output format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Oct 2014 12:42:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Speeding-up-export-to-CSV/m-p/735170#M263144</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-10-01T12:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Speeding up export to CSV</title>
      <link>https://community.qlik.com/t5/QlikView/Speeding-up-export-to-CSV/m-p/735171#M263145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a hidden table and exported that, works a lot faster &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now just to work out how to speed up the write to the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 06:48:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Speeding-up-export-to-CSV/m-p/735171#M263145</guid>
      <dc:creator />
      <dc:date>2014-10-02T06:48:47Z</dc:date>
    </item>
  </channel>
</rss>

