Export Multiple Tables to Single Excel spreadsheet

From this topic.

Sample window attached. The script in the button will export multiple tables and put them in separate sheets.

You may either download it from there or from here. Your choice! :wink:

EDIT: renamed topic to something making more sense… :laughing:
Export Multiple Table to Excel_2014-10-27_0935.proj (20.6 KB)

This link you provided is not working.

This is close to what I am looking for and was hoping to look at the project to help figure out what I needed. Can you possibly fix the download link?

Rats! I hate it when the forum drops my stuff.

Actually, it’s not needed anymore, since system.dataset.dataSetToExcel() has it built in (as of 7.9.8). You will need to make a list out of the datasets you use:

# get datasets
dataIn_1 = event.source.parent.getComponent('Table 1').data
dataIn_2 = event.source.parent.getComponent('Table 2').data

# create spreadsheet
spreadsheet = system.dataset.dataSetToExcel(1, [dataIn_1, dataIn_2])

# set file path to save the spreadsheet
filepath = 'c:/path/to/save/results.xls'

# write the file
system.file.writeFile(filepath, spreadsheet)

I Have Same Doubts In Perspective. How should i do this in perspective. i’ve multiple tables i want to export this tables one after another in a single excel sheet.
i using this Code…

data_1 = self.parent.getChild("FlexContainer").getChild("Table").props.data
data_2 = self.parent.getChild("FlexContainer").getChild("Table_0").props.data
fileName = 'Example File'
data_tab = [data_1,data_2]
datasetData = []
for tabName in data_tab:
	data = tabName
	headers = data[0].keys()
	for row in range(len(data)):
		rowData = []
		for col in range(len(headers)):
			cell = data[row][headers[col]]
			if hasattr(cell, 'value'):
	       finalDataset = system.dataset.toDataSet(headers,datasetData)		
excelFileName =  str(fileName) + ".xlsx"
excelBytes = system.dataset.toExcel(True,[finalDataset]) #returns .xls file as bytes
system.perspective.download(excelFileName, excelBytes)

i not get my desired output…
How should i need to modify this code…
i want…
each table print one after another with some space(One Column)…

i am new in this environment…
Thanks For Advance :slight_smile: