Script to remove or hide Table Name in Numbers?

Hi guys,

I’m currently using this script to create a numbers document (below)

However, It creates a Table Name (‘Table 1’) at the top of the document, which annoyingly becomes a row, wehn exported to Excel.

Is there any way to either create the table without this Name, or remove it after the table has been created?

Thanks!

set shellDate to do shell script "date +'%Y%m%d'TEST"
set fileType to ".numbers"
set todaysDate to (current date)
set the nameToUse to shellDate
-- make sure the file name is not in use
set the destinationFolderHFSPath to ¬
	(path to the desktop) as string
repeat with i from 0 to 100
	if i is 0 then
		set incrementText to ""
	else
		set incrementText to "-" & (i as string)
	end if
	set thisFileName to nameToUse & incrementText
	set thisFilePath to destinationFolderHFSPath & thisFileName & fileType
	tell application "Finder"
		if not (exists document file thisFilePath) then exit repeat
	end tell
end repeat

tell application "Numbers"
	activate
	
	set thisDocument to make new document
	tell thisDocument to tell sheet 1 to tell table 1
		delete first row
		delete first column
	end tell
	save thisDocument in file thisFilePath
end tell

Replace the last part of your script by :


tell application "Numbers"
	activate
	
	set thisDocument to make new document
	tell thisDocument to tell sheet 1
		tell table 1
			delete first row
			delete first column
		end tell
		set name of table 1 to "" # No longer exported in Excel
	end tell
	save thisDocument in file thisFilePath
end tell

tell application "System Events" to tell process "Numbers"
	set frontmost to true
	tell window 1
		its name --> "Sans titre"
		class of UI elements
		--> --> {scroll area, button, scroll area, button, button, scroll area, button, button, radio group, UI element, button, button, static text, scroll area, button, button, button, menu button, toolbar, image, static text}
		(*
		tell scroll area 1
			position --> {189, 119}
			size --> {989, 926}
		end tell
		tell scroll area 2
			position --> {236, 91}
			size --> {942, 28}
		end tell
		tell scroll area 3
			position --> {189, 1046}
			size --> {989, 34}
		end tell
		*)
		tell scroll area 4
			-- position -->  {1179, 300}
			-- size --> {270, 780}
			class of UI elements
			--> {static text, pop up button, pop up button, pop up button, checkbox, static text, group, static text, pop up button, color well, text field, incrementor, checkbox, static text, group, group, checkbox, color well, UI element, static text, static text, text field, incrementor, button, static text, text field, incrementor, button, image, image, scroll bar}
			name of checkbox 1 --> "Nom du tableau"
			if (value of checkbox 1) = 1 then click checkbox 1 # uncheck it
		end tell
	end tell
end tell

In fact the part triggering System Events is not needed here. Setting the title to “” is sufficient.
I pass the code in case you need it for an other problem.

Yvan KOENIG running Sierra 10.12.4 in French (VALLAURIS, France) mercredi 3 mai 2017 17:27:42

Thanks so much Yvan!
I added

set name to ""

to the tell block and everything looks great.

HI there - I have a similar problem but want to actually hide the table name entirely. Any way that can be done. Also trying to use Applescript to turn on the feature “Alternating Row Colors” - is there a GUI script that can do either or both of these since Applescript does not seem to have any native ability to do it?