office-scripts-docs icon indicating copy to clipboard operation
office-scripts-docs copied to clipboard

Filter a table - copy the filtered results

Open JohnR471 opened this issue 6 months ago • 2 comments

Type of issue

Code doesn't work

Feedback

On Page https://learn.microsoft.com/en-us/office/dev/scripts/resources/samples/table-samples, under the heading "Filter a table" there is a "Tip" box which offers the following tip "Copy the filtered information across the workbook by using Range.copyFrom. Add the following line to the end of the script to create a new worksheet with the filtered data." (my emphasis) with the following Typescript code workbook.addWorksheet().getRange("A1").copyFrom(table.getRange()); . This code, however, does not copy only the filtered set of table data, rather it copies the entire (un-filtered) table data. It would be good if the code were corrected to achieve the stated objective.

Page URL

https://learn.microsoft.com/en-us/office/dev/scripts/resources/samples/table-samples

Content source URL

https://github.com/OfficeDev/office-scripts-docs/blob/main/docs/resources/samples/table-samples.md

Author

@o365devx

Document Id

b772ec99-a2e5-eb1c-8b87-2179f24664f4

JohnR471 avatar Aug 21 '24 07:08 JohnR471