def to_csv(self, filename=None,
               encoding=export.ENCODING, dialect=export.DIALECT,
               make_filename=export.MAKE_FILENAME):
        """Dump the worksheet to a CSV file.

        Args:
            filename (str): result filename (if ``None`` use ``make_filename``)
            encoding (str): result string encoding
            dialect (str): :mod:`csv` dialect name or object to use
            make_filename: template or one-argument callable returning the filename

        If ``make_filename`` is a string, it is string-interpolated with an
        infos-dictionary with the fields ``id`` (spreadhseet id), ``title``
        (spreadsheet title), ``sheet`` (worksheet title), ``gid`` (worksheet
        id), ``index`` (worksheet index), and ``dialect`` CSV dialect to
        generate the filename: ``filename = make_filename % infos``.

        If ``make_filename`` is a callable, it will be called with the
        infos-dictionary to generate the filename:
        ``filename = make_filename(infos)``.
        """
        if filename is None:
            if make_filename is None:
                make_filename = export.MAKE_FILENAME
            infos = {
                'id': self._spreadsheet._id,
                'title': self._spreadsheet._title,
                'sheet': self._title,
                'gid': self._id,
                'index': self._index,
                'dialect': dialect,
            }
            if isinstance(make_filename, string_types):
                filename = make_filename % infos
            else:
                filename = make_filename(infos)
        with export.open_csv(filename, 'w', encoding=encoding) as fd:
            export.write_csv(fd, self._values, encoding, dialect)
Dump the worksheet to a CSV file.

        Args:
            filename (str): result filename (if ``None`` use ``make_filename``)
            encoding (str): result string encoding
            dialect (str): :mod:`csv` dialect name or object to use
            make_filename: template or one-argument callable returning the filename

        If ``make_filename`` is a string, it is string-interpolated with an
        infos-dictionary with the fields ``id`` (spreadhseet id), ``title``
        (spreadsheet title), ``sheet`` (worksheet title), ``gid`` (worksheet
        id), ``index`` (worksheet index), and ``dialect`` CSV dialect to
        generate the filename: ``filename = make_filename % infos``.

        If ``make_filename`` is a callable, it will be called with the
        infos-dictionary to generate the filename:
        ``filename = make_filename(infos)``.