advanced form field importing from an excel spreadsheet - php

I have a .xlsx Microsoft Excel spreadsheet containing thousands of rows, each representing a form field. I need to reconstruct the entire form so that it may be filled out by users and their responses submitted to a MySQL database.
It seems impractical to create a form using for example WordPress plugin NinjaForm, manually creating thousands of fields through the WordPress dashboard. They have functionality for importing, but it seems to be designed only for importing forms that were exported using the ninjaforms UI. The syntax seems complex and undocumented publicly.
I'm not married to the idea of using NinjaForms, but it seems plausible to find some kind of forms creation plugin or software that allows form field importation.
Here's an example of how my data is formatted
http://i.stack.imgur.com/PRkz2.jpg

First export to CSV then try this two plugins :
https://wordpress.org/plugins/wp-csv/
https://wordpress.org/plugins/wp-ultimate-csv-importer/
I use it with a custom post page and this plugin :
https://wordpress.org/plugins/advanced-custom-fields/

Related

HTML with JScript to read/write XLS file

Very sorry if this is not in the right place etc. I have been researching this for a while but its raised more questions!
I have developed a spreadsheet which I use to set a teams duties for a shift. There are 5 teams, each with staff which can change day to day.
the spreadsheet works fine, but its too complicated for some users. I am therefore trying to develop a straightforward web based form.
All the data is on the spreadsheet, held on a network drive (essentially locally).
I need to be able to have several combo/select boxes which get their values from a range of cells from the XLS. Along with the ability to output the final selections to a XLS sheet.
Finally, it needs to be able to load the previous day values on load.
What is the best way of developing a web page for this? Is Jscript the best option? Can I access a local file with jScript?
Thanks in advance
Adrian
The easiest option for you is to use google web forms. These allow creation of forms that will submit data to a google spreadsheet. Which is essentially an uploaded version of your local spreadsheet and can be downloaded to excel.
In case if you want more control and programming, pure javascript cant play with files, you need server side too. Javascript is not necessary unless you want to make your app do some visually fancy stuff. Since you mentioned php as a tag of this question, it seems you are a bit familiar with php. The task you have mentioned can be done using php programming as below:
Read excel file using an excel plugin
Parse relevant data using a text matching function, may require regular expressions knowledge.
display the form by building up the html and putting in the variables using the data obtained above.
Write a method to save the data submitted by the form to the same excel file using the excel plugin.
As its not convenient to play around with excel files. A better option would be to generate csv file or use a database using a database class . csv files can be parsed easily using text.

Migrate Codeigniter Database to Wordpress

I have been trying to import or migrate the Codeigniter database into wordpress. Is that possible to do by any means? I have searched for the solution for it at many places but was unable to find a relevant solution to it.
The real problem is that I have already got a website created in CodeIgniter but now I am making a new site for the same using Wordpress. I need to import all the data and posts contained in the older site into the new one. Maybe database migration can be a easier idea. How will be doing so??
Codeigniter is a development framework for building applications. WordPress is a system that's already built. I think you could build a large application like WordPress with Codeigniter. But it would then rely on Codeigniter's libraries and framework, so to make that happen I think you would have to rebuild WordPress from scratch. Unless Codeigniter can be used as more of a PHP editing framework as well?
Maybe a Codeigniter guru will weigh in.
Source https://wordpress.org/support/topic/codeigniter-wordpress
The main issue with this is that your CI database is not structured the same as wordpress database.
There are some tools that help you import databases in wordpress like this plugins:
WP Ultimate CSV Importer Plugin
Really Simple CSV Importer
CSV Importer
but you will have to provide them the CSV file, that you'll have to export from your CI website. I don't think the import process is very complicated but it's sure easier if you spend some time understanding wordpress databse structure, for that a great resource is the wordpress code and the Database Description page.
The complexity of the CSV file is determined by the objects that you have to import in WordPress here is a check list that its good to have when you start building a CSV file:
1) Are you importing custom post types or just blog entires?
2) Do you have extra info on your import objects that have to be imported as custom fields?
3) Do you have users that you need to import? if you do, what roles do you need to have? do you require custom roles (this makes things very complicated)
4) Do you objects have images attached to them? if they do you'll have to make sure that the import plugin is able to import images!
5) Do you have categories and tags? do they have extra info besides wordpress default info?
When I have to import data to WordPress I try to keep it as simple as possible, I'm trying to import only blog posts and their images if possible depending on the complexity of the initial website I might import categories and tags too but I might split the process before adding this and process them after I have the posts in my wordpress site (this is because I'm more comfortable working with wordpress database and functions then with 3rd party CSV generated files - it might not be your case since you have full access to the initial CI website)
In the end have a look at the plugins I've linked or search yourself some import plugins and check the CSV files they need and try to make the CI website generate a CSV file that is similar with the ones in the examples.
If you have experience with the WordPress databse structure then you can also create a script that loads your data from one database to the other one (I recommend this approach for developers that have experience with both the old websites and WordPress at code/database structure level.
if you can share your databse scheme some extra info might be given.
Export posts from CI database in CSV/XML format or SQL and then change it to CSV accordingly. after that, use WP all import plugin and select the columns correctly. Easy as that..

How to generate graphical report from a table?

I'm fairly new to wordpress and I like to ask on how to do or what plugins to use for a specific task.
I am currently using a table plugin (tablepress) and I'd like to use the data from my input to generate a graph (pie or donut chart). Is there a way (or plugin) I could make it? Also if I want to use that data on other events, do I have to manipulate the database manually? Thanks!
The "TablePress" plugin gives you an option of exporting you tables in CSV format. The "TablePress" stores your table's data in the database in the "posts" table.
After exporting you can use the "Visualizer" plugin to then create charts from the exported CSV file.
Take a read of the "Visualizer" plugin's knowledge base to figure out how to use it.
Reference:
StackOverflow link relating to Wordpress Charts Plugin - Wordpress Charts Plugin?
Let me know if this works for you.

Show view in Drupal based off of Excel Spreadsheet

I have been asked a favor of a friend who uses drupal to help them implement a way that they can easily upload an excel document and have it draw out certain fields of the data on a different page in paragraphs and headers.. I have experience in Python, ASP.NET, and PHP but have never used drupal and know nothing about it. If i was given the task in those languages it would be very simple for me but since I know absolutely nothing about Drupal I was curious if someone could just explain to me how this could be done in Drupal so that i could then research and implement at the same time.
Thank you and I appreciate any help or guidance.
First I would create a content type with the suitable fields to contain the data, and a 'file' field to allow the upload of the excel spreadsheet.
Then in a custom module I would use hook_form_alter to add a secondary submit handler (that runs before the main one) to the node add form, and in the new submit handler would parse the spreadsheet and populate the other node fields.
Then after this Drupals main submit handler will run and create the node with your values.
Once you have a node with the data you want it in take a look at the views module for an easy way to output / display the data. Views can create blocks and blocks can easily be inserted into any region in your theme.
Another Way might be the feeds module. There is also an excel parser https://drupal.org/project/feeds_excel , though I only used csv imports.
You set up a content type with the appropriate fields for the each of the columns in your spreadsheet you want to import.
you configure feeds to import them into that specific content type
I hope it helps somewhat.

Handling dynamic CSV headings in PHP/Mysql

I know the title isn't the most descriptive, but I can't think of a better way to describe it.
Ultimately what I would like to do is this:
I am making a system that handles import of data via CSV from several different companies. Naturally, the format from each company is slightly different, with different amounts of data in each column/heading and a different arrangement.
I could either:
Hard code the file format into the program, which is quick and simple to program, but not abstract or future proof
or provide "dynamicity" by allowing users to configure "file formats" in the system, by dragging and dropping CSV headings and saving presets for each incoming file format.
I would like to do option 2, but how would I go about doing this?
I am guessing a tagging style system would do it... but any advice would be appreciated.
I am using PHP, MySQL, and CodeIgniter 2.0.2 if that helps, and also have access to all the Zend libraries in my app.
Assuming that users will be submitting a subset of possible data types that you define up front, this shouldn't be too tough.
A simple form that allows the user to select the data type and give you the field name in their csv could be used to create the templates you mentioned. Store these in a database table associated with the user and make them choose a template before importing a csv. For customers who have csvs without header rows, a slight variation where they tell you the column numbers for each data type.
I'd also suggest providing pre-defined formats for customers who haven't defined their exports yet. That way they could build their exports to one of your formats.
You could also let users define their default template. That way they wouldn't have to select the template every time they import data if they're always importing data in the same format.

Categories