Programmatically insert spreadsheet in document

Hello im wondering if i can insert an spreadsheet table in a document via content control. i know that you can insert charts using Api.CreateChart() like this

window.Asc.plugin.event_onDocumentContentReady = async function () {
		
		const y_axis = mapped.map(i=>{return i.value});
		const x_axis = mapped.map(i=>{return i.time});
		console.log(y_axis,x_axis);
			await window.Asc.plugin.executeMethod("GetAllContentControls", null, function (data) {
				for (var i = 0; i < data.length; i++) {
					if (data[i].Tag == "indicator") {
						console.log('Found indicator:', data[i]);
						var arrDocuments = [{
							"Props": data[i],
							"Script": `
									var oParagraph = Api.CreateParagraph();
									let chart = Api.CreateChart(
										"bar",
										[[${y_axis.join(',')}]],
										["value"],
										[${x_axis}],
										4051300,
										2347595,
										24
									)
									oParagraph.AddDrawing(chart);
									var document = Api.GetDocument();
									document.InsertContent([oParagraph]);
							`
						}];

						window.Asc.plugin.executeMethod("InsertAndReplaceContentControls", [arrDocuments]);


						break;
					}
				}
			});
	};

And the result would be something like this

i want to know if its possible to do the same but in tabular form like the 2nd picture via plugins.
Manually inserted table Insert -> Table -> InsertSpreadsheet

Obs.: both of this pictures are double clickable and open a little spreasheet to be edited

Thanks.

1 Like

Hello @edlacer

I am verifying the possibility to interact with table editor in document editor similarly to Insert > Table > Insert Spreadsheet, but from plugin. Please await my feedback.

1 Like

Hello @Constantine, any updates on this?

As an alternative i been checking out the ApiTable documentation and i found this method
AddElement but it seems to only be able to receive one cell at a time.
Im wondering now if i can create a table with CreateTable and feed the data i want in a matrix.

Hello @edlacer
We have added enhancement to internal tracksystem for the described scenario. Thank you for pointing us to this situation!
We will update this thread once this feature is released.