Follow these steps to use this spreadsheet to
export your comments from Disqus and import them into your Wordpress database
Make a copy of this Google Spreadsheet
Go to File -> Make a copy
Get an export of all the published posts from your blog.
Run this query in your Wordpress database and copy it into the 'Blog posts' tab of this spreadsheet.
If you don't know how to do this, then look into PHPMyAdmin, or MySQL Workbench or your hosting CPanel
- there are many ways to do this, so it's not possible to describe all the different methods here.
Note: please ensure you keep the yellow column on this sheet. You may empty it, but it is used in Step 5
select ID,post_date,post_name,post_title from wp_posts where post_type='post' and post_status='publish';
Get a list of the Disqus comments that are already imported to Wordpress
If your WP blog already has some Disqus comments in the database, then this step is required in order to avoid duplicate comments.
Run this SQL statement in your database:
select comment_agent from wp_comments where comment_agent like 'Disqus/%';
Copy the results from this query into the sheet 'Existing Disqus comments' - they will be matched when you generate the import SQL
Create a Disqus API application
Login with an administrator account and then follow the prompts to create an application.
This will give you API keys which you should copy into the 'Settings' tab of this spreadsheet
Finish configuration in Settings
Change the URL on the 'Settings' tab to point to your Wordpress website
Run the Disqus Export
If you have already used the sheet for a Disqus export, please start by selecting the option "Clear previous export" from the Add-ons menu under "Disqus Export".
If you haven't already run any scripts in this project, you will be asked to authorise the scripts to run.
In the Add-ons menu under "Disqus Export" select the option "Start/Continue Disqus Export". The script will export your comments from Disqus
using the API and these will be copied to the 'Disqus Export' tab of this spreadsheet.
You may have to run this script multiple times because if you have many blog posts or comments you will exceed the maximum script execution time
allowed by Google.
Once the script has successfully exported the comments from a blog post, the "done" column on the "Blog posts" sheet will be set to TRUE,
so it will be skipped the next time.
Generate the Import SQL
Select the Add-ons "Disqus Export" menu option "Generate Import SQL" to generate the SQL that you can use to import the exported disqus
comments into your database. This will go through each row in the tab "Disqus export" and generate an SQL insert.
Import the comments into your WP database
First ensure you have your Wordpress blog (especially the database) backed up. You can use the plugin UpDraft plus
Then take a copy of the last comment ID in your database (in case of issues with the export). You can use this query:
select max(comment_ID) from wp_comments;
Then, copy and paste the SQL statements from the "Import SQL" tab and run them in your database.
Update blog post comment_count
We need to manually update the comment_count in the wp_posts table to reflect the comments we just imported.
Please run this SQL in your WP database:
set comment_count=(select count(*) from wp_comments wc where wc.comment_post_ID = ID and wc.comment_approved="1")
where ID in (select published_posts.ID from
(select wp.ID from wp_posts wp where wp.post_type='post' and wp.post_status='publish') as published_posts);
Disable the Disqus plugin - login to your Wordpress dashboard, to the Plugins, and then click "Deactivate" under the Disqus plugin.
You will then be able to see your comments using the Wordpress comment system
Don't forget to cancel your Disqus subscription!
 If there are any script errors, you can inspect the logs
Go to "My Executions" in the menu on the left.
You will see a list of all the scripts that have been run and clicking on any of those
will allow you to inspect the logs and any errors that may have happened
 ERROR 1366 (HY000): Incorrect string value: '\xF0\x9F\x8C\xB8' for column 'comment_content'
If you have problems with emoji's when you copy and paste the import SQL into the database, please take a look at this Quora article I wrote
 Missing comments
If there are missing comments, please take a look at the script logs to see why the comment was not added to the import SQL .
See above for instructions on how to check the logs.
There are 3 reasons why comments would be skipped:
1) The comment already exists in the database (see tab "Existing Disqus comments")
2) The comment was duplicated in the tab "Disqus exports", which can happen if the export times out in the middle of processing comments for a particular blog post
3) The parent comment is missing - perhaps the user deleted their comment?
 Your gravatar profile picture is missing
Unfortunately disqus does not provide email addresses for the comment authors, so profile pictures will not show up unless
you update the comment author email address in the database. This is example SQL updating the email address for a single user:
update wp_comments set email@example.com' where comment_author='Name of the author';
Important to note
Do not change any of the names of the sheets otherwise the scripts will break