HTML ਟੇਬਲ ਬਦਲਣ ਦੇ ਕਈ ਤਰੀਕੇ ਹਨ into ਜੇ ਐਸ ਐੱਨ, ਸੀ ਐੱਸ ਵੀ ਅਤੇ ਐਕਸਲ ਸਪਰੈਡਸ਼ੀਟ ਵਰਤਦੇ ਹੋਏ ਗਰੈਬਜ਼ਿਟ ਦਾ ਏਐਸਪੀ.ਨੇਟ API, ਇੱਥੇ ਵਿਸਤ੍ਰਿਤ ਕੁਝ ਸਭ ਤੋਂ ਲਾਭਦਾਇਕ ਤਕਨੀਕਾਂ ਹਨ. ਪਰ ਤੁਹਾਨੂੰ ਸ਼ੁਰੂ ਕਰਨ ਤੋਂ ਪਹਿਲਾਂ ਯਾਦ ਰੱਖੋ ਕਿ ਫੋਨ ਕਰਨ ਤੋਂ ਬਾਅਦ URLToTable, HTMLToTable or ਫਾਈਲ ਟੋਟੇਬਲ theੰਗ Save or SaveTo ਟੇਬਲ ਨੂੰ ਹਾਸਲ ਕਰਨ ਲਈ methodੰਗ ਨੂੰ ਬੁਲਾਇਆ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ. ਜੇ ਤੁਸੀਂ ਜਲਦੀ ਦੇਖਣਾ ਚਾਹੁੰਦੇ ਹੋ ਕਿ ਇਹ ਸੇਵਾ ਤੁਹਾਡੇ ਲਈ ਸਹੀ ਹੈ ਜਾਂ ਨਹੀਂ, ਤੁਸੀਂ ਕੋਸ਼ਿਸ਼ ਕਰ ਸਕਦੇ ਹੋ HTML ਟੇਬਲ ਕੈਪਚਰ ਕਰਨ ਦਾ ਸਿੱਧਾ ਪ੍ਰਦਰਸ਼ਨ ਇੱਕ ਯੂਆਰਐਲ ਤੋਂ.
ਹੇਠਾਂ ਦਿੱਤਾ ਕੋਡ ਉਦਾਹਰਣ ਪਹਿਲੇ HTML ਟੇਬਲ ਨੂੰ ਇੱਕ ਨਿਰਧਾਰਤ ਵੈਬਪੰਨੇ ਵਿੱਚ ਬਦਲਦਾ ਹੈ intਸੀਐਸਵੀ ਦਸਤਾਵੇਜ਼
grabzIt.URLToTable("https://www.tesla.com"); //Then call the Save or SaveTo method
grabzIt.HTMLToTable("<html><body><table><tr><th>Name</th><th>Age</th></tr> <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr> </table></body></html>"); //Then call the Save or SaveTo method
grabzIt.FileToTable("tables.html"); //Then call the Save or SaveTo method
ਮੂਲ ਰੂਪ ਵਿੱਚ ਇਹ ਪਹਿਲੀ ਟੇਬਲ ਨੂੰ ਪਰਿਵਰਤਿਤ ਕਰੇਗਾ ਜਿਸਦੀ ਇਹ ਪਛਾਣ ਕਰਦਾ ਹੈ intਓਏ ਟੇਬਲ. ਹਾਲਾਂਕਿ ਇੱਕ ਵੈੱਬ ਪੇਜ ਵਿੱਚ ਦੂਜੀ ਟੇਬਲ ਨੂੰ ਇੱਕ 2 ਪਾਸ ਕਰਕੇ ਤਬਦੀਲ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ TableNumberToInclude
ਜਾਇਦਾਦ
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.TableNumberToInclude = 2; grabzIt.URLToTable("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.csv");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.TableNumberToInclude = 2; grabzIt.HTMLToTable("<html><body><table><tr><th>Name</th><th>Age</th></tr> <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr> </table></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.csv");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.TableNumberToInclude = 2; grabzIt.FileToTable("tables.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.csv");
ਤੁਸੀਂ ਇਹ ਵੀ ਨਿਰਧਾਰਤ ਕਰ ਸਕਦੇ ਹੋ TargetElement
ਪ੍ਰਾਪਰਟੀ ਜੋ ਨਿਸ਼ਚਤ ਕੀਤੇ ਐਲੀਮੈਂਟ ਆਈਡੀ ਦੇ ਅੰਦਰ ਸਿਰਫ ਟੇਬਲ ਨੂੰ ਪਰਿਵਰਤਿਤ ਕਰੇਗੀ.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.TargetElement = "stocks_table"; grabzIt.URLToTable("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.csv");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.TargetElement = "stocks_table"; grabzIt.HTMLToTable("<html><body><table id='stocks_table'><tr><th>Name</th><th>Age</th></tr> <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr> </table></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.csv");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.TargetElement = "stocks_table"; grabzIt.FileToTable("tables.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.csv");
ਇਸ ਦੇ ਉਲਟ, ਤੁਸੀਂ ਵੈੱਬ ਪੇਜ 'ਤੇ ਸਾਰੇ ਟੇਬਲਾਂ ਨੂੰ ਸਹੀ ਤੇ ਪਾਸ ਕਰ ਸਕਦੇ ਹੋ IncludeAllTables
ਜਾਇਦਾਦ, ਹਾਲਾਂਕਿ ਇਹ ਸਿਰਫ XLSX ਜਾਂ JSON ਫਾਰਮੈਟ ਨਾਲ ਕੰਮ ਕਰੇਗੀ. ਜੇ ਤੁਸੀਂ ਐਕਸਐਸਐਲਐਕਸ ਫਾਰਮੈਟ ਦੀ ਚੋਣ ਕਰਦੇ ਹੋ ਤਾਂ ਹਰੇਕ ਟੇਬਲ ਤਿਆਰ ਕੀਤੀ ਸਪਰੈਡਸ਼ੀਟ ਵਰਕਬੁੱਕ ਦੇ ਅੰਦਰ ਇੱਕ ਨਵੀਂ ਸ਼ੀਟ ਵਿੱਚ ਪਾ ਦਿੱਤਾ ਜਾਵੇਗਾ.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.Format = TableFormat.xlsx; options.IncludeAllTables = true; grabzIt.URLToTable("https://www.tesla.com", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.xlsx");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.Format = TableFormat.xlsx; options.IncludeAllTables = true; grabzIt.HTMLToTable("<html><body><table><tr><th>Name</th><th>Age</th></tr> <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr> </table></body></html>", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.xlsx");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.Format = TableFormat.xlsx; options.IncludeAllTables = true; grabzIt.FileToTable("tables.html", options); //Then call the Save or SaveTo method grabzIt.SaveTo("result.xlsx");
GrabzIt HTML ਟੇਬਲ ਨੂੰ JSON ਵਿੱਚ ਬਦਲ ਵੀ ਸਕਦਾ ਹੈ, ਹੇਠਾਂ ਦਰਸਾਏ ਅਨੁਸਾਰ JSON ਫਾਰਮੈਟ ਨੂੰ ਨਿਰਧਾਰਤ ਕਰੋ. ਇੱਥੇ ਅਸੀਂ ਸਮਕਾਲੀ ਨਾਲ ਡੇਟਾ ਨੂੰ ਪੜ ਰਹੇ ਹਾਂ intਓ GrabzItFile
ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਇਕਾਈ SaveTo
methodੰਗ, ਹਾਲਾਂਕਿ ਆਮ ਤੌਰ 'ਤੇ ਇਹ ਸਿਫਾਰਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ ਕਿ ਤੁਸੀਂ ਅਜਿਹਾ ਕਰੋ ਅਸਿੰਕਰੋਨੋਜੀ ਨਾਲ ਇਸਦੀ ਬਜਾਏ
ਇੱਕ ਵਾਰ ਜਦੋਂ ਨਤੀਜਾ ਆਉਂਦਾ ਹੈ ਤਾਂ ਸਾਨੂੰ ਪ੍ਰਾਪਤ ਹੁੰਦਾ ਹੈ string ਨੂੰ ਕਾਲ ਕਰਕੇ JSON ਫਾਈਲ ਦੀ ਨੁਮਾਇੰਦਗੀ ToString
methodੰਗ ਹੈ, ਇਸ ਨੂੰ ਫਿਰ ਡੀਸੀਰੀਅਲ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ into ਆਪਣੀ ਮਨਪਸੰਦ JSON ਲਾਇਬ੍ਰੇਰੀ ਦੀ ਵਰਤੋਂ ਕਰਦਿਆਂ ਗਤੀਸ਼ੀਲ objectਬਜੈਕਟ
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.Format = TableFormat.json; options.TableNumberToInclude = 1; grabzIt.URLToTable("https://www.tesla.com", options); GrabzItFile file = grabzIt.SaveTo(); if (file != null) { string json = file.ToString(); }
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.Format = TableFormat.json; options.TableNumberToInclude = 1; grabzIt.HTMLToTable("<html><body><table><tr><th>Name</th><th>Age</th></tr> <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr> </table></body></html>", options); GrabzItFile file = grabzIt.SaveTo(); if (file != null) { string json = file.ToString(); }
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.Format = TableFormat.json; options.TableNumberToInclude = 1; grabzIt.FileToTable("tables.html", options); GrabzItFile file = grabzIt.SaveTo(); if (file != null) { string json = file.ToString(); }
ਤੁਸੀਂ ਇੱਕ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਨੂੰ ਪਾਸ ਕਰ ਸਕਦੇ ਹੋ ਸਾਰਣੀ ਵਿੱਚ shownੰਗ ਜਿਵੇਂ ਹੇਠਾਂ ਦਰਸਾਏ ਗਏ ਹਨ, ਇਹ ਮੁੱਲ ਫਿਰ ਤੁਹਾਡੇ ਗਰੈਬਜ਼ਿਟ ਏਐਸਪੀ.ਨੈੱਟ ਹੈਂਡਲਰ ਨੂੰ ਵਾਪਸ ਕਰ ਦਿੱਤਾ ਜਾਵੇਗਾ. ਉਦਾਹਰਣ ਵਜੋਂ ਇਹ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਇੱਕ ਡੇਟਾਬੇਸ ਪਛਾਣਕਰਤਾ ਹੋ ਸਕਦਾ ਹੈ, ਜਿਸ ਨਾਲ ਸਕ੍ਰੀਨਸ਼ਾਟ ਨੂੰ ਕਿਸੇ ਵਿਸ਼ੇਸ਼ ਡਾਟਾਬੇਸ ਰਿਕਾਰਡ ਨਾਲ ਜੋੜਿਆ ਜਾ ਸਕਦਾ ਹੈ.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.CustomId = "123456"; grabzIt.URLToTable("https://www.tesla.com", options); //Then call the Save method grabzIt.Save("http://www.example.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.CustomId = "123456"; grabzIt.HTMLToTable("<html><body><h1>Hello World!</h1></body></html>", options); //Then call the Save method grabzIt.Save("http://www.example.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); TableOptions options = new TableOptions(); options.CustomId = "123456"; grabzIt.FileToTable("example.html", options); //Then call the Save method grabzIt.Save("http://www.example.com/Home/Handler");