Masukan File Excel ke mySQL lewat php

  1. 7 tahun lalu

    ada yang bisa masukan data excel ke MySQL lewat php g?

  2. 6 tahun lalu

    tghfox

    5 Okt 2017 Terverifikasi Bekasi Barat + 579 Poin

    ini melampirkan atau memasukan isi data excel bos, kalo melampirkan bisa tanya k forum php,
    klo data yang ada di file excelnya bisa menggunkan macro, berikut contoh upload ke SQL Server, untuk My SQL tinggal disesuaikan drivernya

    Sub sp_UploadEmailUser()
    Dim lBrs As Long
    
    lBrs = Range("A" & Rows.Count).End(xlUp).Row
    
        If lBrs < 5 Then
        MsgBox "Tidak ada yang akan diUpload", vbInformation, "Info"
        Exit Sub
        End If
        
        If lBrs > 54 Then
        MsgBox "Data melebihi 50, yg akan diproses hanya 50", vbInformation, "Info"
        End If
        
        If fn_Scurity() = 0 Then
        Exit Sub
        End If
    
        'Declare variables'
        Set objMyConn = CreateObject("ADODB.Connection")
        Dim strSQL As String
    
        'Open Connection'
        objMyConn.ConnectionString = _
            "Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=DB_Name;User ID=userxx;Password=1234;"
        objMyConn.Open
        
        lBrs = IIf(lBrs > 54, 54, lBrs)
    
        For i = 5 To lBrs
        
            sUser = Range("A" & i).Value
            sAddress = Range("D" & i).Value
        
            'Set and Excecute SQL Command'
            strSQL = "update TBL_M_USER set EMAIL_ADDRESS = '" & sAddress & "' where CODE_USER = '" & sUser & "'"
        
            'exec
            objMyConn.Execute strSQL
            
            Range("E" & i).Value = "ü"
            Range("E" & i).Font.Name = "Wingdings"
        
        Next i
            
        objMyConn.Close
        Set objMyConn = Nothing
        
    
    MsgBox "Proses upload data selesai", vbInformation, "Info"
    End Sub

 

atau Mendaftar untuk ikut berdiskusi!