You are viewing limited content. For full access, please sign in.

Question

Question

Output values from multiple documents to csv file

asked on January 20, 2016

Hi all,

 

I am trying to work out how to retrieve field values from  a number of documents within a folder and then outputting these values to a CSV file. Looking through other posts i found a script to write to CSV file ( i do not know VB :- ) and this works very well on a single entity :-

Now if i try to run this on a folder using for each entry, i just get either files is locked, or i only ever get one entry in the csv.

 

What i am trying to achieve is that for each entry a new row needs to be added, regardless of how many documents within the folder. It should always amend the document.

 

Can anyone help?

 

Mark

0 0

Replies

replied on January 20, 2016

One thing that I see that will help is when you call the StreamWriter constructor with one parameter, you essentially are overwriting the file if exists or creating a new file (from the MSDN docs: The path parameter can be a file name, including a file on a Universal Naming Convention (UNC) share. If the file exists, it is overwritten; otherwise, a new file is created.). In order to append to the file, you need to add another boolean parameter to the constructor as so:

Dim csvWriter As New System.IO.StreamWriter("c:\TestData\Test.csv",true)

This will make sure to append to the file.

1 0
replied on January 21, 2016

Hi Chris,

 

Thanks for the suggestion. I have made this change and i am still getting the locking issue when it hits the 2nd document

so the CSV only contains the header, and the first row of metadata

Has anyone any other thoughts

Regards

 

Mark

 

0 0
replied on February 3, 2016

Hi,

 

Thanks for the rsponses, somone pointed me to this article and it helped me resolve the issue

 

http://answers.laserfiche.com/questions/77293/How-to-export-multivalue-token-into-csv-file

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.