How to Clear Table Style in Office Scripts

0 votes

How can I remove all of the styles from a table? I attempted to record the macro, but when I do so and attempt to run it, it fails (Table setPredefinedTableStyle: The argument is invalid or missing or has an incorrect format.).

function main(workbook: ExcelScript.Workbook) {
  let selectedSheet = workbook.getActiveWorksheet();
  let mainTable = selectedSheet.getTable("MainTable");
  mainTable.setPredefinedTableStyle("undefined");
}

How can I clear the table style?

https://learn.microsoft.com/en-us/javascript/api/office-scripts/excelscript/excelscript.table?view=office-scripts#setpredefinedtablestyle-predefinedtablestyle-

enter image description here

Dec 25, 2022 in Others by Kithuzzz
• 38,000 points
770 views

1 answer to this question.

0 votes

Excel tables on the web are constantly styled. There is no method to delete every style. The most fundamental style, "none," doesn't seem to be assignable in any way. I'll check in on that.

enter image description here

The closest I can get to was to use TableStyleLight1 style as shown below.

function main(workbook: ExcelScript.Workbook) {
  let selectedSheet = workbook.getActiveWorksheet();
  let mainTable = selectedSheet.getTable("MainTable");
  mainTable.setPredefinedTableStyle('TableStyleLight1')
}
answered Dec 25, 2022 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
1 answer

How to clear TextField Entered Text automatically in Flutter?

Hi@akhtar, You can control the TextField in your ...READ MORE

answered Sep 10, 2020 in Others by MD
• 95,460 points
37,840 views
0 votes
1 answer
0 votes
1 answer

How to generate the "create table" sql statement for an existing table in postgreSQL

Create a table for a demo: CREATE TABLE ...READ MORE

answered Jun 20, 2022 in Others by nisha
• 2,210 points
531 views
0 votes
1 answer

How to get second-highest salary employees in a table

SELECT MAX(SALARY) FROM Employee WHERE SALARY < ...READ MORE

answered Nov 7, 2022 in Others by gaurav
• 23,260 points
1,794 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
1,212 views
0 votes
1 answer

Cannot access web3 object with typescript and ethereum

You still need to instantiate it first. ...READ MORE

answered Sep 25, 2018 in Blockchain by slayer
• 29,370 points
2,886 views
0 votes
1 answer

ImportError: openpyxl is required for loading excel format files

Forget the PsychoPy complications for the time ...READ MORE

answered Oct 3, 2018 in Python by Priyaj
• 58,020 points
1,079 views
0 votes
1 answer

In Blue Prism how to split excel column data into TWO columns

This is how I am doing it. Dim ...READ MORE

answered Oct 15, 2018 in RPA by Priyaj
• 58,020 points
4,369 views
0 votes
1 answer

How to express absolute cell references in Excel R1C1-style formulas?

If the formulas are in Column K ...READ MORE

answered Oct 15, 2022 in Others by narikkadan
• 63,600 points
1,018 views
0 votes
1 answer

Export HTML Table to Excel- Doesn't Open in Office 2010

We had the same issue too many ...READ MORE

answered Oct 21, 2022 in Others by narikkadan
• 63,600 points
758 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP