Download xlsx version of spreadsheet.
351918
def export_xlsx(self, key):
        
        spreadsheet_file = self.client.files().get(fileId=key).execute()
        links = spreadsheet_file.get('exportLinks')
        downloadurl = links.get('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
        resp, content = self.client._http.request(downloadurl)
        return content
1000608
def to_excel(self, *args):
        
        path = os.getcwd()
        fname = self.fname.replace(".tpl", "_tpl") + ".xlsx"
        idxs = self.filter_trends("")
        for idx in idxs:
            self.extract(idx)
        data_df = pd.DataFrame(self.data)
        data_df.columns = self.label.values()
        data_df.insert(0, "Time [s]", self.time)
        if len(args) > 0 and args[0] != "":
            path = args[0]
            if os.path.exists(path) == False:
                os.mkdir(path)
            data_df.to_excel(path + os.sep + fname)
        else:
            data_df.to_excel(self.path + os.sep + fname)
1248076
def main(flags):
    

    dl = SheetDownloader(flags)
    dl.init()

    for file_info in settings.GOOGLE_SHEET_SYNC['files']:
        print('Downloading {}'.format(file_info['path']))
        dl.download_sheet(
            file_info['path'],
            file_info['sheet'],
            file_info['range'],
        )
785964
def open(cls, title, conn=None, google_user=None,
             google_password=None):
        
        spreadsheet = cls.by_title(title, conn=conn, google_user=google_user,
                                   google_password=google_password)
        if spreadsheet is None:
            spreadsheet = cls.create(title, conn=conn, google_user=google_user,
                                     google_password=google_password)
        return spreadsheet
46425
def wr_xlsx(self, fout_xlsx, nts):
        """"""
        wr_xlsx(fout_xlsx, nts, prt_flds=self.prt_flds, fld2col_widths=self.fld2col_widths)
800686
def export_to_xlsx(table, filename_or_fobj=None, sheet_name="Sheet1", *args, **kwargs):
    """"""

    workbook = Workbook()
    sheet = workbook.active
    sheet.title = sheet_name
    prepared_table = prepare_to_export(table, *args, **kwargs)

    # Write header
    field_names = next(prepared_table)
    for col_index, field_name in enumerate(field_names):
        cell = sheet.cell(row=1, column=col_index + 1)
        cell.value = field_name

    # Write sheet rows
    _convert_row = _python_to_cell(list(map(table.fields.get, field_names)))
    for row_index, row in enumerate(prepared_table, start=1):
        for col_index, (value, number_format) in enumerate(_convert_row(row)):
            cell = sheet.cell(row=row_index + 1, column=col_index + 1)
            cell.value = value
            if number_format is not None:
                cell.number_format = number_format

    return_result = False
    if filename_or_fobj is None:
        filename_or_fobj = BytesIO()
        return_result = True

    source = Source.from_file(filename_or_fobj, mode="wb", plugin_name="xlsx")
    workbook.save(source.fobj)
    source.fobj.flush()

    if return_result:
        source.fobj.seek(0)
        result = source.fobj.read()
    else:
        result = source.fobj

    if source.should_close:
        source.fobj.close()

    return result
777423
def xlsx_to_reader(xlsx_wb):
    
    fh = xlsx_to_strio(xlsx_wb)
    return xlrd.open_workbook(file_contents=fh.read())
125740
def _do_download(version, download_base, to_dir, download_delay):
    """"""
    py_desig = 'py{sys.version_info[0]}.{sys.version_info[1]}'.format(sys=sys)
    tp = 'setuptools-{version}-{py_desig}.egg'
    egg = os.path.join(to_dir, tp.format(**locals()))
    if not os.path.exists(egg):
        archive = download_setuptools(version, download_base,
            to_dir, download_delay)
        _build_egg(egg, archive, to_dir)
    sys.path.insert(0, egg)

    # Remove previously-imported pkg_resources if present (see
    # https://bitbucket.org/pypa/setuptools/pull-request/7/ for details).
    if 'pkg_resources' in sys.modules:
        _unload_pkg_resources()

    import setuptools
    setuptools.bootstrap_install_from = egg
1324252
def version_downloads(self):
        """"""
        ret = OrderedDict()
        for release, info in self.release_info:
            download_count = sum(file_['downloads'] for file_ in info)
            ret[release] = download_count
        return ret
1102767
def sheets(self):
        
        # http://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/XSpreadsheetDocument.html#getSheets
        try:
            return self._sheets
        except AttributeError:
            target = self._target.getSheets()
            self._sheets = SpreadsheetCollection(self, target)
        return self._sheets
93091
public static SpreadsheetVersion getVersion(final Sheet sheet) {
        ArgUtils.notNull(sheet, "sheet");

        if(sheet instanceof HSSFSheet) {
            return SpreadsheetVersion.EXCEL97;

        } else if(sheet instanceof XSSFSheet) {
            return SpreadsheetVersion.EXCEL2007;
        }

        return null;
    }
70041
public XceliteSheet getSheet(String sheetName) {
    Sheet sheet = workbook.getSheet(sheetName);
    if (sheet == null) {
      throw new XceliteException(String.format("Could not find sheet named \"%s\"", sheetName));
    }
    return new XceliteSheetImpl(sheet, file);
  }
517582
function saveWorkbook(cb) {
		//console.log(wb);
		var XLSX;

		if (typeof filename == 'undefined') {
			res = wb;
		} else {
			XLSX = getXLSX();

			if (utils.isNode || utils.isMeteorServer) {
				XLSX.writeFile(wb, filename);
			} else {
				var wopts = {bookType: 'xlsx', bookSST: false, type: 'binary'};
				var wbout = XLSX.write(wb, wopts);

				function s2ab(s) {
					var buf = new ArrayBuffer(s.length);
					var view = new Uint8Array(buf);
					for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xff;
					return buf;
				}

				/* the saveAs call downloads a file on the local machine */
				//				saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), '"'+filename+'"')
				//				saveAs(new Blob([s2ab(wbout)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}), filename)
				//				saveAs(new Blob([s2ab(wbout)],{type:"application/vnd.ms-excel"}), '"'+filename+'"');
				if (isIE() == 9) {
					throw new Error(
						'Cannot save XLSX files in IE9. Please use XLS() export function'
					);
					//					var URI = 'data:text/plain;charset=utf-8,';

					/** @todo Check if this code is required */

					/*/*
					var testlink = window.open("about:blank", "_blank");
					var s = '';
					for(var i=0,ilen=wbout.length;i<ilen;i++) {
						var ch = wbout.charCodeAt(i);
						if(i<20) console.log('&#'+ch+';');
						s += '&#x'+ch.toString(16)+';';
					};
					testlink.document.write(s); //fileData has contents for the file
					testlink.document.close();
					testlink.document.execCommand('SaveAs', false, filename);
					testlink.close();
*/
					//					alert('ie9');
				} else {
					saveAs(new Blob([s2ab(wbout)], {type: 'application/octet-stream'}), filename);
				}
			}
		}
		/*/*
		// data.forEach(function(d){
		// 	s += columns.map(function(col){
		// 		return d[col.columnid];
		// 	}).join(opts.separator)+'\n';
		// });
		// alasql.utils.saveFile(filename,s);
*/
	}
764714
def simple_export2xlsx(filename, titles, qs, func_data):
    
    output = BytesIO()
    wb = xlwt.Workbook(output)
    ws = wb.add_worksheet(filename)
    header_fmt = wb.add_format()
    header_fmt.set_bg_color('#C4D89E')
    row_idx = 0
    row_idx = xlsw_write_row(ws, row_idx, titles, header_fmt)
    for o in qs:
        row_idx = xlsw_write_row(ws, row_idx, func_data(o))
    fn = '%s-%s.xlsx' % (filename, datetime.now())
    return export_xlsx(wb, output, fn)
1043615
def loadInternalSheet(klass, p, **kwargs):
    ''
    vs = klass(p.name, source=p, **kwargs)
    options._set('encoding', 'utf8', vs)
    if p.exists():
        vd.sheets.insert(0, vs)
        vs.reload.__wrapped__(vs)
        vd.sheets.pop(0)
    return vs
645086
def sheets(self):
        """"""
        data = Dict()
        for src in [src for src in self.zipfile.namelist() if 'xl/worksheets/' in src]:
            name = os.path.splitext(os.path.basename(src))[0]
            xml = self.xml(src)
            data[name] = xml
        return data
1107141
def xd(self):
        """"""
        if self._xd is None:
            # download files if the user requests
            if None not in (self.download_start_datetime, self.download_end_datetime):
                self._download()

            self._xd = super(ERAtoGSSHA, self).xd
            self._xd.lsm.lon_to_180 = True
        return self._xd