Import data from excel file to php database

Import data from excel file to php database

Import data from excel file to php database

You have an Excel file, and if you want to import that Excel file to your database, then fetch the cell value using these tutorials. You can directly import to your MySQL, MS SQL, and various databases using this library and tutorials. Just download the library and integrate the below code there.

Step 1)

Download the Excel read library from here. click here for download

Step 2)

Make a form for uploading your Excel file as below.

<html>
<body>
    <form method="post" enctype="multipart/form-data">
        <table>
            <tr>
                <td>
                    Select File:
                </td>
                <td>
                    <input type="file" name="file" id="file">
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left">
                    <input type="submit" name="submit" value="Submit">
                </td>
            </tr>
        </table>
    </form>
</body>
</html>

Step 3)

Now make code to read the Excel file cell and import it to the database as below.

<?php
include('PHPExcel-1.8/Classes/PHPExcel/IOFactory.php');

if(isset($_POST["submit"]))
{
	$inputFileName = $_FILES["file"]["tmp_name"];

	try {
		$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
		$objReader = PHPExcel_IOFactory::createReader($inputFileType);
		$objPHPExcel = $objReader->load($inputFileName);
	} catch (Exception $e) {
		die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . 
		$e->getMessage());
	}

	$sheet = $objPHPExcel->getSheet(0);
	$highestRow = $sheet->getHighestRow();
	$highestColumn = $sheet->getHighestColumn();

	$newArr = array();
	for($row = 1; $row <= $highestRow; $row++) { 
		$rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, null, true, false);

		array_push($newArr, $rowData);
	}

    echo "<pre>";
    print_r($newArr);
	
    echo "Record Update Successfully...";
}
?>

Step 4)

Now upload your Excel to the form and submit the Excel; it will return you all the cell values, which you will insert into your database.

5 responses

5 thoughts on “Import data from excel file to php database”

  1. craybet_pton

    Been using Craybet for about six weeks or so and thought I’d throw out some thoughts since I haven’t seen many posts about them around here. Registered randomly one night and registration took maybe two minutes. Starting deposit was $10 and that’s pretty standard. I grabbed a sign-up bonus — 100 percent match to $500 and fifty free spins on Gates of Olympus. Playthrough requirements were 35x and that isn’t amazing but not the worst I’ve seen.

    Game selection is honestly pretty solid. You’ll find stuff from Pragmatic Play, NetEnt, and Play’n GO — meaning Book of Dead, Gonzo’s Quest, that kind of thing. I’d guess maybe a couple thousand titles total if you count everything. The live dealer section is powered by Evolution and it’s smooth — played some blackjack and Crazy Time with real dealers and had no complaints.

    Now the one thing that kinda bugged me was how long cashouts take. Tried cashing out with Visa and it took almost two days for my first withdrawal. After that though it was faster. They accept Visa, Mastercard, Skrill, Neteller, and BTC so that covers pretty much everything you’d want. You can check out the full bonus details at CrayBet to see for yourself.

    Using Craybet on my phone is actually smooth. No dedicated app — the mobile site loads fast and everything works fine. Was playing Book of Dead in bed and didn’t notice any performance issues.

    Support at Craybet is alright — they have live chat that gets you a person pretty quick usually. Had to ask about a bonus that didn’t credit and it was resolved same day. I think they’re Curacao-based from what I can tell and that’s typical of platforms like this. It’s not flawless — promo codes seem rare — but as a daily player it does the job for me.

  2. craybet_hton

    So I’ve been messing around on Craybet for like a couple months and wanted to share some thoughts because there’s not many posts about it on here. Signed up after seeing an ad and registration was like 90 seconds. Min deposit was $10 and that’s pretty standard. I grabbed a sign-up bonus — matched my first deposit 100% up to 500 and fifty free spins on Gates of Olympus. Rollover is 35 times the bonus which is kinda average but it’s manageable.

    Game selection is decent honestly. You’ll find games from Pragmatic Play, Betsoft, plus Microgaming — so like Gates of Olympus, Gonzo’s Quest, the usual heavy hitters. Probably close to 2000 games when you add it all up. Live dealer stuff runs on Evolution and it’s legit — tried roulette and Lightning Roulette with actual croupiers and had no complaints.

    Now the one thing that annoyed me a little was payout speed. Tried cashing out with Bitcoin and waited about 48 hours for my first withdrawal. Second time around it dropped to like 24 hours. You can use Visa, Mastercard, e-wallets like Skrill and Neteller, Bitcoin so that covers most bases. I’d look at their current offers at Craybet to see for yourself.

    Using Craybet from my iPhone is actually smooth. I didn’t find a native app though the web app runs well and everything works without issues. I played Book of Dead in bed and had zero performance issues.

    Support at Craybet has been alright — live chat that actually connects in under five minutes usually. Reached out once about a bonus that didn’t credit and got it fixed within hours. I think they’re Curacao licensed which is standard for offshore casinos. It’s not flawless — promo codes seem rare — but for what it is I keep coming back.

  3. craybet_szon

    So I’ve been playing on Craybet for roughly a couple months and figured I’d share some thoughts because there’s not many posts about them around here. I signed up on a whim and the whole process literally took two minutes. Starting deposit was $10 and that’s about what you’d expect. I grabbed a sign-up bonus — 100% up to $500 and 50 free spins on Sweet Bonanza. Playthrough requirements were 35 times the bonus which could be lower but it’s manageable.

    Game selection is honestly pretty solid. You’ll find stuff from Pragmatic Play, Evolution, plus Play’n GO — meaning Book of Dead, Starburst, all the popular ones. Probably close to a couple thousand titles when you add it all up. The live dealer section uses Evolution and it’s legit — played some roulette and Lightning Roulette with actual croupiers and it worked great.

    Now the one thing that annoyed me a little was withdrawal times. I used Skrill and it took like a day and a half the first time. Second time around it dropped to like 24 hours. Payment options include credit cards, e-wallets like Skrill and Neteller, and crypto so that covers pretty much everything you’d want. You can check out their current offers at svnewtech if you’re interested.

    Mobile experience on Craybet on mobile worked better than expected. I didn’t find a native app but the mobile site is responsive and all the games load fine. Was playing Book of Dead in bed and no lag or glitches.

    Customer service on Craybet has been alright — they have live chat that gets you a person within a few minutes when I’ve used it. Had to ask about a bonus that didn’t credit and got it fixed pretty quickly. Not sure about Curacao-based from what I can tell which is typical of platforms like this. Not everything is amazing — wish they had more payment options — but as a daily player it does the job for me.

  4. craybet_dhon

    Been playing on Craybet for like two months now and thought I’d throw out some thoughts since there isn’t much discussion about them around here. I signed up on a whim and signing up was like two minutes. Minimum deposit is $10 which is normal for US-facing sites. They threw in a welcome bonus — matched my first deposit 100% up to 500 and 50 free spins on Gates of Olympus. Playthrough requirements were 35 times the bonus which is kinda average but not the worst I’ve seen.

    Game selection is decent honestly. There’s games from Pragmatic Play, NetEnt, plus Play’n GO — so like Book of Dead, Starburst, that kind of thing. Somewhere around 2000 games including table games. Live casino uses Evolution which is legit — played some blackjack and Crazy Time with actual croupiers and it worked great.

    One thing that kinda bugged me was withdrawal times. Tried cashing out with Skrill and waited like a day and a half for my first withdrawal. Once you’re verified though things sped up. Payment options include Visa, Mastercard, Skrill, Neteller, and crypto which covers pretty much everything you’d want. You can look at their current offers at Craybet if you’re interested.

    Mobile experience on Craybet from my iPhone is actually smooth. There’s no app to download but the web app runs well and all the games load without issues. I played some slots in bed and didn’t notice any lag or glitches.

    Support at Craybet has been alright — there’s a chat widget and someone actually responds in under five minutes most times. Reached out once about my verification docs and it was resolved same day. Not sure about Curacao-based from what I can tell and that’s what most platforms like this. Not everything is amazing — the bonus wagering could be lower — but overall I keep coming back.

  5. craybet_tron

    I’ve been using Craybet for roughly six weeks or so and thought I’d throw out some thoughts since there isn’t a ton of talk about it on here. I signed up after seeing an ad and registration was like two minutes. Minimum deposit is $10 and that’s normal for US-facing sites. Got a sign-up bonus — 100% up to $500 plus fifty free spins on Sweet Bonanza. Rollover is 35x which isn’t amazing but I’ve dealt with worse.

    Game selection is honestly pretty solid. They’ve got games from Pragmatic Play, Evolution, and Big Time Gaming — so like Book of Dead, Starburst, the usual heavy hitters. I’d guess maybe 1500-2000 slots when you add it all up. Live dealer stuff runs on Evolution which is smooth — tried blackjack and Crazy Time with actual croupiers and had no complaints.

    Tbh the thing that annoyed me a little was withdrawal times. Withdrew via Visa and waited like a day and a half the first time. After that though it dropped to like 24 hours. They accept credit cards, Skrill, Neteller, and crypto so that covers most bases. You can look at what they’ve got going on on svnewtech before you sign up.

    Using Craybet on my phone was surprisingly good. No dedicated app — the web app runs well and slots and live games work without issues. I played Book of Dead on the bus and had zero performance issues.

    Support at Craybet is alright — they have live chat that gets you a person in under five minutes usually. Reached out once about my verification docs and got it fixed same day. Not sure about Curacao-based from what I can tell which is typical of platforms like this. It’s not flawless — wish they had more payment options — but for what it is I’m still using it.

Leave a Reply

Your email address will not be published. Required fields are marked *