Recent searches


No recent searches

How to Export Zendesk Guide Data as CSV



Posted Aug 23, 2018

 Here is a script that exports Zendesk Guide Article information as a CSV:

https://github.com/scotthavard92/Zendesk-Help-Center-Export-Scripts

This tool uses the Zendesk Help Center API(https://developer.zendesk.com/rest_api/docs/help_center/introduction) to pull Guide Information and populate it in a csv file. This will output values such as Article Id, Article Title, and Vote Count.

The output looks like:

Here is a nifty video overview and instructional:

https://youtu.be/nGYQwV-kpyE

Let me know if you have any questions!

 


1

41

41 comments

Scott,

I also need to export the article body, but when I added the code to do so, I ran into the same problem that Diogenez experienced (my help center articles are in English): 

File "Zendesk_Guide_Article_Export.py", line 109, in <module>
writer.writerows([output_10])
File "C:\Users\karen.d.snyder\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '​' in position 37400: character maps to <undefined>

I tried replacing ‘NFKD’ with ‘NFKC’, 'NFD', and 'NFC', but the same error occurred. I am not a Python programmer, so I am not familiar with Unicode conversion. The article at https://support.zendesk.com/hc/en-us/community/posts/360004174147-Exporting-help-center-data-to-CSV provides a manual method of exporting articles to CSV by using the API, saving the result as a JSON file, and then using the website https://json-csv.com to convert the JSON to CSV. I did perform this procedure successfully, but it is manual. There was no mention of any Unicode conversion, but perhaps it is handled by the website?

0


Scott, I have no words to thank for your help,

The export went smoothly,

As for your question, my language is en

Sorry for my ignorance, I do not understand programming,

Can you tell me the API of the creation date field? I saw that in the export it returns me the update, we have some goals for the agents based on article creation.

Another question I have is about the order that is set up in excel,

In order to be able to measure and adjust the metrics, I'm having to use a transpose in excel to invert the rows by columns, could I already handle this in the script?

 

0


Scott,

Thank you for your reply.. I tried tweaking your code but the Zendesk Api does not provide this key for articles. So right now i'm just using two different python scripts to get me that. It's basically your script but for sections. It would be great to somehow run both commands in one script and get one file with all the informations.

Thank you for your reply!

0


Cosmin, 

Unfortunately Section ID doesn't easily export from the Zendesk API endpoint that I use :(.

I can do a little digging to see if I can't find another solution.

Good luck!

0


Hi Diogenez!

Thanks for reaching out. So I looked up the error and it looks like a cedilla(ç) is breaking it. Out of curiosity, what language is your data in?

Maybe try replacing the  'NFKC' in lines 47, 51 and 75 with either 'NFD' or 'NFC' and see if that solves the problem? This upcoming week I can dive in more and try to fix it. This is my first guess though, so I would give the above a shot if you are in a hurry.

Here is documentation explaining the character decoding that my script does:

https://docs.python.org/2/library/unicodedata.html#unicodedata.normalize

You can see that there is some commentary on how it tries to interpret characters, including the cedilla.

Let me know if this works!!! Good luck, and keep me up to date!

 

 

 

 

0


Hello Scott, I made the settings using python 3.7 and managed to go from the step I mentioned in the previous comment, but at the end of the export, I returned the error: Number of articles: 333 Traceback (most recent call last):   File "Zendesk_Guide_Article_Export.py", line 93, in <module>     writer.writerows ([output_2])   File "C: \ Python 3.7.2 \ lib \ encodings \ cp1252.py", line 19, in encode     return codecs.charmap_encode (input, self.errors, encoding_table) [0] UnicodeEncodeError: 'charmap' codec can not encode character '\ u0327' in position 31: character maps to <undefined> Do you know what it can be and how to solve it?

0


Hello Scott, how are you?

I'm trying to run the script anyway, but it returns the same error reported by Mary Paez, "Enter your Zendesk Subdomain (not full URL, but something such as your company name): topisuporte
Traceback (most recent call last):
File "Zendesk_Guide_Article_Export.py", line 8, in <module>
subdomain = input("Enter your Zendesk Subdomain (not full URL, but something such as your company name): ")
File "<string>", line 1, in <module>
NameError: name 'topisuporte' is not defined" Could it be my language? en I tried to change the line but without success, If I get the line of code: url = 'https: //' + subdomain + '. Zendesk.com/api/v2/help_center/en/articles.json?sort_by=title&sort_order=asc' To change to my subdomain and use in the browser, the data is returned successfully. Would you have any tips to give? Thank you very much,

0


Hi Scott! 

Thanks for your reply. I have a meeting with our Lead Developer next week to see what works for us. 

I will let you know the outcome of that meeting.

Ron

0


Hi Scott great work here.. I was wondering if there is a possibility to tweak the script so that it returns Category ID or title of Category for an article as well? (like you did with Section Id)

Thank you

Cosmin

0


Hi Ron!

Sorry for the delay on a response. It looks like it is possible to get the body of the article outputted as a CSV. See the 'body' key of this page https://developer.zendesk.com/rest_api/docs/help_center/articles/.

Do you want just the body of the information? Or all of the information in addition (i.e. article id, title, etc.)?

Either way, I think it is possible. If you are familiar with Python, it should be pretty straight forward to edit this script: https://github.com/scotthavard92/Zendesk-Help-Center-Export-Scripts/blob/master/Article_Information_Export/Zendesk_Guide_Article_Export.py.

You will essentially want to do what Mary (above in the comments) did for 'draft', but do it for 'body' instead. something like:

for article in data['articles']:
  body = article['body']
  decode_10 = unicodedata.normalize('NFKD', body)
  output_10.append(decode_10)

You will also need to add the info to the write rows section at the bottom and the header appending at the top. 

I am happy to help you figure it out! let me know.

 

 

 

0


Sign in to leave a comment.

Didn't find what you're looking for?

New post