• 17-06-2021, 16:54:16
    #1
    Merhaba, aşağıdaki kodla excele aktarma yapıyor. Ama her satır'ın A sutununa komple yazıyor adsoyadı sicil noyu vs..

    SicilNo', 'AdSoyad', 'GorevUnvani', 'GorevMudurlugu', 'Tc', 'BaslamaTarihi', 'KadroMudurlugu
    A B C D E F G şeklinde tek tek sutunlara yazdırabilmek.. Bu konu bilgisi olan var mı?

    <?php
    
    session_start();
    require_once 'config/config.php';
    require_once BASE_PATH . '/includes/auth_validate.php';
    
    $db = getDbInstance();
    $select = array('SicilNo', 'AdSoyad', 'GorevUnvani', 'GorevMudurlugu', 'Tc', 'BaslamaTarihi', 'KadroMudurlugu');
    
    
    $chunk_size = 100;
    $offset = 0;
    
    $data = $db->withTotalCount()->get('personeller');
    $total_count = $db->totalCount;
    
    $handle = fopen('php://memory', 'w');
    
    fputcsv($handle,$select);
    $filename = 'export_personeller.csv';
    
    
    $num_queries = ($total_count/$chunk_size) + 1;
    
    //Prevent memory leak for large number of rows by using limit and offset :
    for ($i=0; $i<$num_queries; $i++){
    
        $rows = $db->get('personeller',Array($offset,$chunk_size), $select);
        $offset = $offset + $chunk_size;
        foreach ($rows as $row) {
    
            fputcsv($handle,array_values($row));
        }
    }
    
    // reset the file pointer to the start of the file
    fseek($handle, 0);
    // tell the browser it's going to be a csv file
    header('Content-Type: application/csv; charset=UTF-8');
    // Save instead of displaying csv string
    header('Content-Disposition: attachment; filename="'.$filename.'";');
    //Send the generated csv lines directly to browser
    echo "\xEF\xBB\xBF"; // UTF-8 BOM
    fpassthru($handle);
  • 18-06-2021, 08:31:17
    #2
    excel inde ekran goruntusunu paylasirsaniz ciktinin ne olduguna gore daha net yorum yapilabilir. CVS ciktisi aliyosunuz, excelle actiginizda tum kolonlarin tek kolonda olmas normal.
    suna bir goz atin once.
    https://stackoverflow.com/questions/...ferent-columns
  • 18-06-2021, 09:07:14
    #3
    crooper adlı üyeden alıntı: mesajı görüntüle
    excel inde ekran goruntusunu paylasirsaniz ciktinin ne olduguna gore daha net yorum yapilabilir. CVS ciktisi aliyosunuz, excelle actiginizda tum kolonlarin tek kolonda olmas normal.
    suna bir goz atin once.
    https://stackoverflow.com/questions/...ferent-columns


    böyle geliyor. Sicil no A ya Adsoyad B'ye Görev ünvanı C'ye vsvs bu sekilde ayrı sutunlara gelmesini istiyorum. Ücretli/ücretsiz yardımcı olabilir misiniz
  • 18-06-2021, 09:29:43
    #4
    Kimlik doğrulama veya yönetimden onay bekliyor.
    hocam virgüllere ayrılmış csv bu bunu csv to excel olarak da dönüştürüp kullanabilirsiniz excel formatında açılcaktır
  • 18-06-2021, 09:31:27
    #5
    çevirdiğiniz xls değil csv, php içindeki uzantıyı xls yapın, açarken uyarı verir ama excel gibi açar.
  • 18-06-2021, 11:04:27
    #6
    Direkt yapmanız gereken;


    https://www.youtube.com/watch?v=ENe2PzWhSOQ