Reading Excel To MySql Or Comma Delimited ...
right direction on how to deal with an xls
flie.
but the only other file I have to work
with is pdf.
I'm not sure, is xls the better of two evils?
View Complete Forum Thread with Replies
Related Forum Messages:
Comma Delimited File
I am trying to read comma delimited rows of text. The problem is that some fields may be encapsulated in "" - particularly the text fields but not numeric fields. Is there a simple efficient way to parse the fields with comma but also strip off the "" encapsulating some of the fields with php? The problem is the "" encapsulation is optional. Some fields will have it, some won't.
View Replies !
Statement With Comma Delimited Fields
I'm hacking into my vBulletin forum to use individuals current usernames, passwords, and membergroups to setup a premium portion of my site. I have the following query: PHP Code: $users = mysql_query("SELECT * FROM user WHERE username='$username' AND membergroupids=ཛྷ'"); With this query my login works for those who have signed up for the premium content on the forum. One problem is if the members join multiple user created member groups, they're membergroupids will be like 32,10,34. I need my query to find if they belong to 32 and if so allow them access. So, if they belong to 32,10,34 then they should be allowed to enter, but if they belong to 10,34 they should not.
View Replies !
Comma Delimited Csv Has Commas Inside Fields
I need to import a CSV file into a database daily. That operation in itself is simple enough but the trouble is that some fields are quoted because they have commas inside them. How do I handle this with my import script? It would be much better if the CSV was created with all fields quoted or used a different delimited but sadly that is not an option.
View Replies !
Regular Expression For Comma-delimited Pairs
I have a textarea form field for inputting (or pasting) pairs of data. I need a regular expression pattern to validate each line for the following double quote number double quote comma double quote alpha string double quote carriage return The following comes close, but doesn't check for a carriage return at the end of each line: ^"([0-9]?)+"([,]s?"([A-Za-z0-9]+)")*$ For example the following would return true: "1","John" "2","Paul" "3","George" "4","Ringo"
View Replies !
Stripping Quotes Out Of A Comma Delimited File?
I have a flat file that I'm trying to stick into a MySQL database. One record per line, multiple fields per record, and many of them are null fields which are just double quotes without a space between. It's probably nothing really major for people who have done this before, but I'm a bit stumped. The file is comma delimited. Every field is surrounded by double quotes. I've done quite a bit of searching, on the php site and elsewhere, but I can't seem to get it to strip the quotes out so I can explode the file line by line to grab the fields.
View Replies !
Converting Comma Delimited Field Into Array
I have an array that goes into a MySQL database (via PHP). The only way I could find to insert them into the database was using implode. It goes into the database just great, comma separated (although I would like each to go into it's own field, but it's okay for now). The problem comes when I try to display it. Since it's comma delimited it display only the first item in the array. But there are multiple rows that should be displayed. I'm not sure how to explode it so that it will display them all. I've tried a loop but that just looped the first item in the field (the first part of the array). Code:
View Replies !
File Parsing Function For Tab Or Comma Delimited Files
I need a way to parse a file based on the delimitation of either tab or comma. Does anyone know the best way to do this that is the easiest? Also the file I am parsing might have a few empty strings between delimitation. I know about preg_split so if this is the only way could someone provide a link that explains regular expressions because i dont get it.
View Replies !
Create A Comma Delimited String That I Can Convert To An Array Using Explode();.
I am attempting to create a comma delimited string that I can convert to an array using explode();. I have the following code: Code: $cPath_new_a = tep_get_path($categories['categories_id']); $cPath_new_b = str_replace("cPath=", "", "$cPath_new_a"); $cPath_new_c = str_replace("_", "", "$cPath_new_b"); $cPath_new_d = substr("$cPath_new_c", -2, 2); $cPath_new_e = $cPath_new_d . ","; echo $cPath_new_e; This outputs 23,53, I need it to output 23,53 Using the substr($cPath_new_e, 0, -1); and/or rtrim() method to remove the last character for some reason removes all of the commas. Am I approaching this the right way?
View Replies !
Regular Expression :: Find Word Matches To Words In A Comma-delimited List
What's the *right* way to find word matches to words in a comma-delimited list. For example, if I have the following comma-delimited list of categories in a mysql db field: gameboy, nintendo, playstation and I do a search, I know I can use regexp to do something like: select * from categories where regexp 'gameboy,' Notice that I have the comma in there to match the whole word and the comma without matching part of a word (to prevent unwanted matches such as "play" to "playstation" or "game" to "gameboy"). The problem I'm running into is words that match that match the end of each word next to the comma (in this example, "boy" and "station"). What's the right way to match a word *exactly* using regexp *without* also matching *part* of a word.
View Replies !
Reading Tab Delimited File Into Database
I have a .tab file that I need to write to the database. I've read it in, but for some reason it's not reading correctly. I'm truncating the complete database and then reloading it with whatever is in the tab file. I keep getting an error when trying to run my current code which is: Code:
View Replies !
Reading Excel Files Using PHP
Could someone pls give me pointers (or examples) on how to use PHP (installed on a linux) to read & write MS Excel spreadsheets. So far I've been converting a spreadsheet to text (as tab separated values) and processing the text file. I'm wondering if I can avoid this step and process the .xls file directly. I found a thread in this group - related to this topic - but it says, MS excel needs to be installed on target machine to use PHP's COM. I assume he's talking about PHP running on windows target machine. How can I use a similar approach on linux machine? http://groups.google.com/group/comp...300071ba2b4434e
View Replies !
Excel Reading Script
Is MS Excel need to be installed if i want to run some excel reading script like the following? <?php // starting excel $excel = new COM("excel.application") or die("Unable to instanciate excel"); print "Loaded excel, version {$excel->Version}"; //bring it to front #$excel->Visible = 1;//NOT //dont want alerts ... run silent $excel->DisplayAlerts = 0; //open document $excel->Workbooks->Open("C: est.xls"); //XlFileFormat.xlcsv file format is 6 //saveas command (file,format ......) $excel->Workbooks[1]->SaveAs("c: est.csv",6); //closing excel $excel->Quit(); //free the object $excel->Release(); $excel = null; $row = 1; $handle = fopen("C: est.csv", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "$i<br><p> $num fields in line $row: <br /></p>"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . " "; } } fclose($handle); ?>
View Replies !
Reading A Excel File
I want to upload an excel file and read its contents I'm running apache2 on fedora, with PHP 4. Is there an easy way to read an excel file? I'm not tring to store the file, just read its contents, but I've never had a page upload a file, and I'm not sure how to do it. I also have no clue how to read an excel file once I get it uploaded....
View Replies !
Reading An Excel File
Im try to read a 4 byte value and convert it into an integer or floating point value with the following criteria: Thats what the definiton says: An RK valie is an encoded integer or floating-point value. RK values have a size of 4 bytes and are used to decrease the size for floating-point values. Structure of an RK value (32-bit value)...
View Replies !
Reading Excel Spreadsheets
Ok here is what I need... I need a way to read a excel spreadsheet... this is how it is setup... [Name][Phone][Address][City][Zip][Age][Birth-Date] Ok and there is like 60 or so of them I need a form that asks for your name and phone and when you log in it returns that rows address, city, age, birthdate... do you get what I am saying?
View Replies !
Reading A Particular Record From Excel Spreadsheet
I would like to read a particular record from excel spreadsheet. For Example:A Shopping Cart.The data in database and excel sheet are same,but if a user clicks on a particular product say productid:23456 then he can only see that data from excel spreadsheet,though there are other records but no need to show other records. If anyone knows the solution for this please pm me or reply to this message.
View Replies !
Reading EXCEL (XLS) Documents With Other Charactersets
(the other code i cannot post due weird carakters!) I've been searching over the internet for days but havent found why! i've tried alot of scripts (both free or wich i need to pay for) but only a pricy script (like 80$) would show the carakters in ROW C correctly. If i convert the script to a HTML document i get the carakters with &# and a four digit number... that's what i like to extract from the excel sheet. The script i wrote is. Code: <?php $excel = new COM("excel.application") or die("Unable to instanciate excel"); //bring it to front $excel->Visible = 1;//NOT //dont want alerts ... run silent $excel->DisplayAlerts = 1; //open document $excel->Workbooks->Open("d:/excel.xls"); for ($h = 1; $h <= 3; $h++) { $book = $excel->Workbooks(1); $sheet = $book->Worksheets($h); echo "<table> "; //Wtite row for ($i = 1; $i <= 150; $i++) { echo "<tr> "; //write colom for ($j = 1; $j <= 5; $j++) { $cell = $sheet->Cells($i, $j); // #Select the cell (Row Column number) $cell->activate; // #Activate the cell if($cell->value == Ɔ') { $td = ""; } else { $td = $cell->value; } echo "<td>" . $td . "</td> "; // #write the cell } echo "</tr> "; } echo "</table> "; } //closing excel $excel->Quit(); ?>
View Replies !
Reading HTML Table Like Excel Does
If I open a text file that consists of a simple HTML table then Excel with display the TR and TD as rows and columns like it would a CSV file. Is there any way to parse an HTML table using PHP in a similar fashion to this as I can with fgetcsv()? The file is kind of big so running it through a big preg_match_all() doesn't look feasible memory wise.
View Replies !
Stopping A For Loop While Reading A Excel File
This is trying to read an unknow amount of info from a excel file. i used a for loop to do this, but could not get it to stop. $over = 1; for ($i=1;$over=1;){ $excel_cell = $Worksheet->Cells($i,1); $excel_cell->activate; $excel_result = $excel_cell->value; print "$excel_result"; $i++; $excel_cell = $Worksheet->Cells($i,1); $excel_cell->activate; $excel_result = $excel_cell->value; if ($excel_result = null){ $over = 0;} } i thought if it picked up a blank cell value it would be null, but that does not stop the loop. i tried uusing "" and '' as well, but with no success.
View Replies !
MySQL: Searching With Joins Or Delimited List
I'm trying to implement a solution where a given company can set a list of the coutries in which it has branches. My first thought is this: 'company' (id, co_name) 'location' (id, co_id, loc_code) And when the customer want to know if a company has a location in Belize: select c.co_name from company c left outer join location l on l.co_id = c.id where l.loc_code = 'BZ' My second thought is adding loc_code to company: Code:
View Replies !
Mysql To Excel And Then Email The Excel Doc
I have a good working code for making a excel doc. on the fly. He send the file to the screen and you can save it directly. But I dont want it to send it to the screen but that he save it on the server and EMAILS it to someone. I'm searching and trying to get it work for 3 days, but no luck. I hope you guys can help me out. This is the code I use the make an excel doc. $select = "SELECT * FROM dagrapport WHERE dagrapportid='$dagrapportid'"; $result = mysql_query($select); $datum = mysql_result($result,0,'datum'); $medewerkernummer = mysql_result($result,0,'medewerkernummer'); $export = mysql_query($select); $fields = mysql_num_fields($export); $kop = ""; $data = ""; for ($i = 0; $i < $fields; $i++) { $kop .= mysql_field_name($export, $i) . " "; } while($row = mysql_fetch_row($export)) { $line = '' foreach($row as $value) { if ((!isset($value)) OR ($value == "")) { $value = " "; } else { $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . " "; } $line .= $value; } $data .= trim($line)." "; } $data = str_replace(" ","",$data); if ($data == "") { $data = " (0) Records Found! "; } header("Content-type: application/x-msexcel"); header("Content-Disposition: attachment; filename=dagrapport-$datum-$medewerkernummer.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$kop $data";
View Replies !
Importing A Flat Pipe Delimited File Into A MySQL Data Table
I have done this in perl but eeew I don't want to use perl anymore. I want to be able to take a flat file that looks like this: mbriones@...|Marian|Briones bobsmith@...|Bob|Smith janedoe@...|Jane|Doe (etc) The table has more than 3 fields, so I'd want to process the flat file and then do an INSERT into mailinglist SET field=$value for each line. Does someone have a nice way for me to do this? The flat file will be uploaded to the server via a form (copy) and then be processed.
View Replies !
Comma Separated List In MySQL Field
say I have a list of categories in a field, and a page that is supposed to pull from the db based on a category. Is there any way I can do a query where it searches the contents of that field for the category in question? like SELECT FROM table WHERE category = $category but have it search the category field (the comma separated list for each entry) for the $category var
View Replies !
From MySQL To Excel (through PHP)
it's possible to manage an exixtent excel file with PHP? : i already have an excel file formatted in many fileds, and i have to modify only some of these fields (i need to add data). unrotunately with tutorials i found trough google i can substitute tables in my excel file, and i cannot modify the fields, it overwrites and stop.
View Replies !
Excel To MySQL
I currentley use Navicat for most of my Excel to MySQL conversions. But I would like to get this web based. Ideally the user would submit a standard .xls via a form upload. Now here is the complex part. The file has 6 spreadsheets in it. Each spreadsheet has different columns and some of those columns need to go into different tables. So it's NOT just xls to one mysql table. It's actuallt one xls file with numerous spreadsheets going into different MySQL tables based on the column names.
View Replies !
Excel > XML > MySQL
I am wondering if there is a way I can use an upload form to upload an Excel XML export or just an .xls file to a MySQL database. I am also wondering if there is a tutorial out there that can help. So far I have only been able to find sites that offer tools to do it, but I want to use an upload form instead.
View Replies !
Php , Mysql And Excel
IŽd want to pass the result of a mysql to an xls file (excel) , obviously all into my php page. Is it possible? You know, can I pass the results as a whole or do i have to extract each parameter and put it into an xls file ( i have no idea how to do it). Maybe some of you have done it or can give me a clue.
View Replies !
Mysql To Excel
I need to write a program to transfer data from mysql database to Excel. Is there any free php code to do it. I tried one of the code which I got through search .....
View Replies !
MYSQL Excel
I am creating a php/mysql system to run daily chores. That is simple enough. The hard part is the data that populates the database is sent each week via excel spreadsheet (always in the same format - thouhg row numbers change - coloms don't) I want to get this information using php and put the stuff I need from it in the database. Now I have found Navicat which is a great application and did what I needed only I am looking not to use a 3rd party program I simply want a button on the site that wil let you upload a spreadsheet and fill the database correcting any info in the databse allready that is reppeated etc as I won't be the one doing this and for most the users of this post things like navicat are simple enough for the people using the sytem I am creating that is a bit too much like hard work even with all the training. So my question is can this be done and where should I start I pretty much to the point where I realise I will need to open the excel file and stick all the information into an array and then take it from the array and insert into databse. But how do I do this. some links to usefull info or some sample code would help I am quite quick to pick this stuff up when I get on to the right trail.
View Replies !
Excel To MySQL Using PHP...possible?
I've read almost all the Excel XLS to MySQL info in the PHP help section. No one seems to know how to do this. Just says to covert the file to .csv first. Problem is that a lot of my clients will not have excel and the file (the .xls) is coming directly from their product manufacturer. So having all the have to get excel is not going to happen. Only thing I found was a reference to : http://nstoia.com/excel2csv/excel2mysql.zip ... which no longer exists. It was supposed to contain a full PHP script on converting XLS to MySQL. Yet the file doesn't exist and the only other things I can find with that file name is a perl script. Sorry but I really don't want to have to get into perl to do this. I know there has to be a way, since you can easily export SQL to XLS. Also, no code snippits or tutorials out there either. Maybe, someone here has found something I haven't and can enlighten me.
View Replies !
Excel CSV To MySql
I have a Excel CSV file with 5000+ records on and I would like to put this into a PHP MySQL database, I have CPANEL and PHP MY ADMIN but i cant seem to find where the section is to upload the file? Can anyone enlighten me to how i go about doing this? I will probably split the csv up into smaller chunks so upload time is not timed out..
View Replies !
Mysql -> Excel
I'm migrating a mysql table into an excel spreadsheet using headers. The problem I'm having is that there are newline characters in some of the fields in the original table that are triggering a new row going into excel.
View Replies !
Need To Convert Mysql To Excel?
I need to display data from MySQL to Excel format. I looked at several excel classes, but they are missing three things that I need. 1. To be able to output a cell larger than 255 characters. 2. Be able to keep line breaks in cells. 3. be able to format the cell widths I am currently using a tab delimited set up with excel http headers, but I can not format the cell widths.
View Replies !
Data From MySQL Into CSV For Excel?
I've a survey form that I need to get data from and put into a mySQL database. Easy, can do it eyes closed. But, then I need to be able to take that same information and convert it (either directly or pulling it back out from the database) into a CSV (or any file for that matter) that can be easily imported, added into an existing Excel database. I've no idea how to do that. (I can query the database, that I can do, and create recordsets, AND create text files, but I've never created a CSV file before.) Is there a source, a good Web site for example, that explains that kind of process pretty well?
View Replies !
MySQL Dump To Excel
I get an error on the actual dump. It does dump the file, so I know I am connecting and downloading. But, it puts all records in one line of text in the browser, and does not give me the prompt to download. Code:
View Replies !
Coding Excel For Php And Mysql Use?
Ok, so i have an excel document that i can enter my current golf scores in on and it'll calculate different stuff with the data that i enter... Is there a way that i could use the formula from excel that calculates that data, and make it so that one could use it on my website and it would also save and store the data that they entered, as well as calculate it like excel does and display the current data.. So quick and to the point, I want a database based way of users using what i would use at home kinda, from excel.
View Replies !
Mysql Database To Excel
This script is to export Mysql database to excel, I'm getting the following error: 1) Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource and 2) Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource can someone help me correct this problem? Code:
View Replies !
Excel To MySQL Import
I need some help with a script that wrote to import an excel spreadsheet into mysql. It is supposed to update records with the same phone number and insert when there is no match. This is meant to eliminate duplicates within the database. It doesn't work quite right though....
View Replies !
Excel To Mysql Conversion
I know its a little off topic, but I was wondering if anyone knows of any freeware excel to mysql conversion utilities? There are a lot of pay ones floating around but was hoping for a free one.
View Replies !
Mysql/PHP To Excel Ouput?
I can successfully, output contents from two mysql tables into excel but I was wondering if there was a way of determining the actual layout - column sizes because at present they are all over tha place? .....
View Replies !
Excel To MySQL With DBCS
There are many tables that I store them in XLS form. Many columns of these tables are stored data by using DBCS -- Big5. Is there any way that I can import datas from those XLS files into MySQL tables? Because the ""--0x5C is a part of many Traditional Chinese characters in BIG5 code set. So I can't use such as "mysqlimport" utilities to import data from XLS to CSV to Mysql. Or do I miss some options when I use mysqlimport?
View Replies !
Export MySQL To Excel
I have no problem exporting data from MySQL to Excel however I've run across two new additions that we'd like to make: 1. We need to add some text to the first few rows before the exported data to denote what the exported data is referencing. 2. We need to add a new column at the end of each row for "TOTAL". The columns are currently created via the exported data however we won't be exporting any data for the TOTAL column, rather we need to use some forumla logic to fill that column in (see #3 below). 3. We need to add some Excel forumla logic to the exported file to calculate the price of a reservation against the total number of reservations. if ($action == "billing") { include("../includes/dbconnect.php"); .....
View Replies !
MySQL Data To Excel
It isn't displaying my table column names as the heading any clues.This is what I have: <?php include 'library/config.php' include 'library/opendb.php' $query = "SELECT * FROM tbl WHERE `Member`='A'"; $result = mysql_query($query) or die('Error, query failed'); $tsv = array(); $html = array(); while($row = mysql_fetch_array($result, MYSQL_NUM)) { $tsv[] = implode(" ", $row); $html[] = "<tr><td>" .implode("</td><td>", $row) .
View Replies !
Download MySQL Data To Excel
I have no issue in getting my data to download into MySQL, but can you A) Style the info? So like make a certain font and size? B) It isn't displaying my table column names as the heading any clues? This is what I have PHP Code:
View Replies !
|