Simple Data Toolkit - Tutorial - PHP - Convert File

September 03, 2023 at 2:55 PM PST
This post has no media.
Profile picture
Franklin Powers

Let's suppose you want to create a task that loads a CSV file into an HTML file on a daily basis. This task is meant to be part of a PHP script, but you are unfamiliar with PHP and are unsure of how to write the code. Good news, you can use the Sample Data Toolkit UI to figure out this code for you as follows:

1) Go to the app page for the Simple Data Toolkit UI, at the time of this writing it is here: https://www.vis-software.com/#sdtk

2) Click Choose Files.

3) Find the file you want to convert.

4) Click Open.

5) Select the output type you want, for this tutorial we will select HTMLTable.

6) Then for script, select PHP.

7) Then click Download Script.

You will now have a PHP script that uses SDTK to convert the file you selected to an HTML. You can now either run this script or integrate it with another one.

If you need to install SDTK for PHP, you can do it by downloading the latest version from SourceForge, unzipping it, and placing it in your include path. At the time of this writing, this can be found here: https://sourceforge.net/projects/simple-data-toolkit/files/0.1.3/sdtk-php.zip/download

The script will look something like this:

use comsdtktableConverter;

set_include_path(get_include_path().PATH_SEPARATOR.__DIR__.'/lib');
spl_autoload_register(
function() {
= stream_resolve_include_path(str_replace('\\', '/', ) .'.php');
if () {
include_once ;
}
}
);
phpBoot::__hx__init();

Converter::start()->readFile("ga_sample.csv")->csv()->textOnly()->output()->writeFile("ga_sample.htmltable")->htmlTable()->execute();

readfile("ga_sample.htmltable");
?>

Any thoughts on Franklin's post?

To comment or reply, you need an Ortingo account.

Sign in or sign up

Here's what Ortingoers think of Franklin's post.

There are no comments on this post.