@param array  $data
@param string $file
@param string $sheet
@param string $range

@throws \MercesLab\Component\SpreadsheetClient\Exception\WriteRequestFailedException
12925
public function write(
        array $data,
        string $file,
        string $sheet = self::DEFAULT_SHEET,
        string $range = self::DEFAULT_RANGE
    ): void {
        $this->doWrite($data, $file, $sheet, $range);
    }
888204
function export(array $data, $sheet) {
		$groups = array();

		// split full list into separate files
		// reading them back in is a lot faster this way
		foreach ($data as $id => $array) {
			$key = floor($id / 1000000);
			$groups[$key][$id] = $array['name'].'.'.$array['sheet'];
		}

		$ext = $this->encoder->name();
		foreach ($groups as $key => $array) {
			$idx = sprintf("%02x", $key);
			$filename = "{$this->path}/{$sheet}-{$idx}.{$ext}";
			file_put_contents($filename, $this->encoder->encode($array));
		}
	}
849248
public function executeFormula($cell)
    {
        $phpCell = $this->sheet->getCell($cell);
        $phpCell->setValue($phpCell->getFormattedValue());
    }
225253
private function writeFile($path, $data)
    {
        if (false === @file_put_contents($path, $data)) {
            throw new DumperException(sprintf('Unable to write file "%s"', $path));
        }
    }
346297
private static function debug_print($file, $level, $format, $data)
    {
        array_shift($data);
        foreach ($data as $k => $v) {
            if (is_string($v)) {
                $data[$k] = str_replace("\n", ' ', $v);
            } elseif ($v instanceof \Exception) {
                $data[$k] = $v->__toString();
            } elseif (!is_numeric($v)) {
                $data[$k] = str_replace("\n", " ", json_encode($v));
            }
        }

        $mtime = microtime(true);
        $time = 1000 * ($mtime - intval($mtime));

        $trace = debug_backtrace();
        $location = $trace[2]['function'];
        for ($n = 2; $n < sizeof($trace); $n++) {
            if (isset($trace[$n]['class'])) {
                $location = $trace[$n]['class'];
                break;
            }
        }

        $id = isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : getmypid();

        $msg = sizeof($data) ? vsprintf($format, $data) : $format;
        error_log(sprintf("[%s.%03d %s %s %s] %s\n", date('d.m.Y H:m:s'), $time, $id, $level, $location, $msg), 3, $file);
    }
983156
public function write(
        array $data,
        string $sheet = ClientInterface::DEFAULT_SHEET,
        string $range = ClientInterface::DEFAULT_RANGE
    ): void {
        $this->doWrite($data, $this->file, $sheet, $range);
    }
580394
public static function write($fileName, $data, $mode = 'w')
    {
        $json = json_encode($data, JSON_PRETTY_PRINT);

        if (json_last_error()) {
            throw new \RuntimeException(json_last_error_msg());
        }

        parent::write($fileName, $json, $mode);
    }
551235
public function write_blank($row, $col, $format = null) {
        $this->worksheet->setCellValueByColumnAndRow($col, $row+1, '');
        $this->apply_format($row, $col, $format);
    }
1352773
public function write($file)
    {
        if (file_exists($file) && !is_writable($file)) {
            throw new RuntimeException("$file is not writable");
        }
        $fp = fopen($file, 'w');
        foreach ($this->lines as $line) {
            fwrite($fp, $line['data']);
        }
        fclose($fp);
    }
856202
private function writeSheets($sheets) {
        foreach ($sheets as $sheet) {
            fseek($sheet->getStream(), 0);
            stream_copy_to_stream($sheet->getStream(), $this->stream);
            fclose($sheet->getStream());
        }
    }
1083591
public function executeLeaveRecords($sheetData = [], $index = [])
	{
		foreach ($sheetData as $key => $data)
		{
			if (in_array($key, $index))
			{
				unset($sheetData[$key]);
			}
		}
		return $sheetData;
	}
62447
private function getPageRange(string $range, int $offset, int $limit)
    {
        $matches = [];

        if (!preg_match('`^([a-zA-Z]+)([0-9]+):?([a-zA-Z]*)([0-9]*)$`', $range, $matches) || count($matches) < 3 || !$matches[1]) {
            throw new ReadRequestFailedException("Could not parse range '$range'");
        }

        $startColumn = $endColumn = $matches[1];
        $startRow = $endRow = (int) $matches[2];

        $startCell = $startColumn.($startRow+$offset);

        if (count($matches) > 4 && $matches[3]) {
            $endColumn = $matches[3];
            $endRow = $matches[4];
        }

        $endCell = $endColumn;

        if ($limit > 0) {
            $endCell .= $endRow+$offset+$limit;
        }

        return "$startCell:$endCell";
    }
365952
private function execute(array $files, $errorMessage)
    {
        $outputMessage = new PreCommitOutputWriter(self::RUNNING_PHPLINT);
        $this->output->write($outputMessage->getMessage());

        $errors = [];
        foreach ($files as $file) {
            $errors[] = $this->phpLintTool->process($file);
        }

        $errors = array_filter($errors);

        if (!empty($errors)) {
            $this->output->writeln($outputMessage->getFailMessage());
            $this->output->writeln($outputMessage->setError(implode('', $errors)));
            $this->output->writeln(BadJobLogoResponse::paint($errorMessage));

            throw new PhpLintViolationsException();
        }

        $this->output->writeln($outputMessage->getSuccessfulMessage());
    }
22010
public function write_formula($row, $col, $formula, $format = null) {
        $this->worksheet->setCellValueExplicitByColumnAndRow($col, $row+1, $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
        $this->apply_format($row, $col, $format);
    }
1093409
public void simpleSheet2Excel(List<SimpleSheetWrapper> sheets, String targetPath)
            throws IOException {

        try (OutputStream fos = new FileOutputStream(targetPath);
             Workbook workbook = exportExcelBySimpleHandler(sheets, true)) {
            workbook.write(fos);
        }
    }
349074
protected function doRead(
        string $file,
        string $sheet,
        string $range,
        int $offset = ClientInterface::DEFAULT_OFFSET,
        int $limit = ClientInterface::DEFAULT_LIMIT
    ): array {
        try {
            $range = $this->getPageRange($range, $offset, $limit);
            $googleFile = $this->googleServiceSheets->spreadsheets_values->get(
                $file,
                $this->getTableRange($sheet, $range)
            );

            return $googleFile->getValues();
        } catch (\Google_Exception $e) {
            throw new ReadRequestFailedException(
                "Failed reading data from GoogleSpreadsheet (file: {$file}, sheet: {$sheet}, table: {$range}).",
                500,
                $e
            );
        }
    }
1272819
public static function arrayToXLS(Array $data, String $file = 'excel.xls')
    {
        $file = Base::suffix($file, '.xls');

        header("Content-Disposition: attachment; filename=\"$file\"");
        header("Content-Type: application/vnd.ms-excel;");
        header("Pragma: no-cache");
        header("Expires: 0");

        $output = fopen("php://output", 'w');

        foreach( $data as $column )
        {
            fputcsv($output, $column, "\t");
        }

        fclose($output);
    }