I have never used a Google App Script to interact with a Google Doc. I’d love to see the document you are starting with and the end result.
The error you are showing is implying that the function name of “deleteRow(i)” does not exist on the object of “table”. Are you sure you are using the correct function name??
Actually, looking in the documentation…the correct function name is “removeRow” not “deleteRow”. Refer to the link below for the available list of functions.
https://developers.google.com/apps-script/reference/document/table