Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+12 votes
2.3k views
in Q2A Core by
Has anyone found a good solution to bulk add questions via upload or import from a CSV, excel, txt or other data file format? I have a list of about 1000 questions I want to pre-populate the site with. Doing this manually would take forever. A plugin, php script, etc... would be most useful.

I'm surprised a bulk question creation tool is not a built in function. Would make it more attractive for developers who want to create large sites on the fly.

If anyone has the programming skills to do this, consider creating a crowd-funding page with needed $ goal to develop this plugin or feature and link to it.

Thanks!
Q2A version: 1.8

6 Answers

+5 votes
by

Hi,

I'm working on a PHP script to import Users, Questions, Answers & Comments.

I had  imported Categories & Sub-Categories directly with a CSV file and PhpMyAdmin. It's a first test very simple to do.

I'll publish my scripts for free but to for a plugin, I have to learn all the functions before this, and it's much more work to do and any $ will be welcome ! (€ for me, I'm french wink)

Regards.

by
Hi,
This is great, thanks.
I tried importing questions from CSV file into mysql which was pretty easy. But there are other DB relationships between the question title and other tables. So I gave up.

Looking forward to what you come up with :)
I will be happy to help beta test.
And can help also help with fund-raising for you if it's working.

Thanks!
by
I also want do this can you provide a link of your code
+1 vote
by
I test this day my first scripts to inject users with the Q2A functions.

It's work fine, with little features I have to extend (changing register date, update state, ...).

To make a massive Q import, it is necessary to have a user who has written them. So you have to create user(s) before and rely them to questions.

Regards & good night (23:37 in France)
by
If it works reliably as a plugin for Questions2Answer, it may be good idea to sell it as a pro-plugin on a platform like Envato (codecanyon.net), codester.com, etc.) and maybe this bulk-add questions selling point feature for developers will help breath some life into this script. Just needs some creative marketing, which I can assist with.
by
It's not a plugin at this time, just a script using Q2A functions qa_* I'm learning about.
I noticed that qa_ function are ready to make plugins, because when errors occurs, qa_ functions a generating some HTML output, and I have to understand this.
I noticed that with a massive (18.000+) user insert, I had some strange values in phpMyAdmin for the IP adresses which are stored in binary format. No problem to display them in Q2A but strange characters in phpMyAdmin... ?

I'll answer you in PM but it's not ready to develop a pro-plugin it's just do-it-yourself at the moment. :o)

I think I'll have users and questions scripts ready for next monday, I'll make a little doc for using it and you and other will can test them but with beta-test databases !

Regards.
by
I have an unexpected job to do before the end of next week, I will not be able to work on the subject until then, but I'll let you know.

Regards
by
Sounds good. Looking forward to helping Beta test it. Just let me know. Thanks!
by
Ready to help test the script. Still there?
by
@max : Yes still there but extra-job to do this week and it's not finish... Go back to work.
by
Hi again:

Any luck with the bulk import script yet?

Thanks
by
You want to import only questions?
by
Yes, I only want to import questions. I have about 700 questions in a text file. I can convert it into a CSV also if that works better for importing.
by
The only thing you need are categoryid, user ID, tags, question title, question text (ignoring created time, IP etc). If these are available in a proper format, then you can just call qa_post_create function.
by
Can you post a link to your script? Thanks
0 votes
by
Hi guys. I did my own system to moderate user messages. I can easily do this, but I have to know how q2a database works.

1. when I add a question, the q2a only add a row in questions table?

2. when I add a user, the q2a only add a row in users table?

Thats because q2a works with a lot of logs and statistics and Id like to know how it works before build something. Can someone answer this 2 questions?
by
For adding question, do not directly write to qa_posts table but instead use the create post function. Most of these functions you can find in qa_include/app folder which internally will call the required database functions.
0 votes
by
edited by
I also want do this can you provide a link of plugin code?
by
+1
pupi1985 made a plugin to import questions too. Check his profile for the link
0 votes
by
Hi,
I have written the script for that , just need to put it in a plugin.
+2 votes
by

Hello there, I have successfully created a Plugin to Import Question along with its answers from an XML or Json file. It is fully working on my website https://givemeans.net/

It is just in testing phase, if I get no errors, I shall make it available to download and contribute on my website.

Check link: https://givemeans.net/q2a-bulk-import

by
Awesome! Looking forward to trying it out. Thanks
by
it is fully working on my site and demonstration is given on the given link.
https://givemeans.net/q2a-bulk-import
...